标签:focus clu oca 为什么 span getc rip using 签到
大致题意就是指看有几个大于等于10,直接按照题意输出就行,签到题
#include<stdio.h> int main(){ int n,a,b,c; scanf("%d",&n); while(n--){ scanf("%d %d %d",&a,&b,&c); int sum=0; printf("%d %d %d\n",a,b,c); if(a>=10) sum++; if(b>=10) sum++; if(c>=10) sum++; if(sum==0){ printf("zilch\n"); }else if(sum==1){ printf("double\n"); }else if(sum==2){ printf("double-double\n"); }else if(sum==3){ printf("triple-double\n"); } printf("\n"); } }
代码:
#include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <string> #include <cstring> #include <map> using namespace std; map <char,int> ma; char q = ‘a‘; int main(){ int t; cin >> t; getchar(); int intm = 1; while(t--){ for(int j = 0;j < 26;j++) ma[q+j] = j; int m; cin >> m; getchar(); for(int j = 0;j < m;j++){ char a,b; cin >> a; getchar(); cin >> b; getchar(); ma[a] = ma[b]; } int n; cin >> n; getchar(); string s[110]; for(int j = 0;j < n;j++){ cin >> s[j]; getchar(); } printf("Test case #%d:\n",intm); intm++; for(int j = 0; j < n;j++){ int fn = 1; int len = s[j].size(); for(int k = 0;k < len / 2;k++){ if(ma[s[j][k]] != ma[s[j][len-k-1]]){ fn = 0; break; } } if(fn == 1) cout << s[j] << " " << "YES" << endl; else cout << s[j] << " " << "NO" << endl; } cout << endl; } return 0; }
意思就是一个给定大小的棋盘,棋盘上面的格子都是可以拿下来的,之后给出移动策略,就是敲方块的顺序,问哪些操作是无效的
代码:
#include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<iostream> #include<vector> using namespace std; int main(){ int a[1000],dx[1000],dy[1000]; int n,m,k,h,l,s; scanf("%d",&n); m=n; while(n--){ scanf("%d %d",&h,&s); for(int i=0;i<s;i++){ scanf("%d %d",&dx[i],&dy[i]); } int sum=0; for(int i=1;i<s;i++){ int flagx=0,flagy=0; if(dx[i]>h){ dx[i]=0; dy[i]=0; sum++; } if(dy[i]>h){ dx[i]=0; dy[i]=0; sum++; } for(int j=0;j<i;j++){ if(dx[j]==dx[i]) flagx++; if(dy[j]==dy[i]) flagy++; } if(flagx>=1&&flagy>=1){ dx[i]=0; dy[i]=0; sum++; } } printf("Strategy #%d: %d\n",m-n,sum); printf("\n"); } }
代码:
#include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<iostream> #include<vector> using namespace std; int ts[1000],ds[1000]; int main(){ int n,t,k,d,m; scanf("%d",&n); m=n; while(n--){ int summ=0; printf("CD #%d:\n",m-n); scanf("%d %d",&t,&k); for(int i=0;i<t;i++){ scanf("%d",&ts[i]); summ+=ts[i]; } scanf("%d",&d); while(d--){ int num,sum=0; scanf("%d",&num); for(int j=1;j<=num;j++){ scanf("%d",&ds[j]); if(j%2==1){ sum+=ds[j]; }else{ int item; if(ds[j-1]%ts[k-1]==0){ item=0; }else{ item=(ts[k-1]-ds[j-1]%ts[k-1]);//item属于没看完的 } if(ds[j]<=item){ sum+=ds[j]; }else{ sum+=(item+((ds[j]-item)/summ*ts[k-1]));//后一部分属于有几个整的cd } if((summ-ts[k-1])<(ds[j]-item)%summ){ sum+=((ds[j]-item)%summ-(summ-ts[k-1])); } } } printf("%d\n",sum); } printf("\n"); } }
2020.3.28 UCF Local Programming Contest 2016补题与解题报告
标签:focus clu oca 为什么 span getc rip using 签到
原文地址:https://www.cnblogs.com/CCCCrack/p/12604655.html