1 #include <stdio.h> 2 3 int main() 4 { 5 int T, n, m, k, act[101]; 6 scanf("%d", &T); 7 while(T--) { 8 scanf("%d%d%d", &n, &m, &k); 9 for(int i=1; i<=m; i++) 10 scanf("%d", act+i); 11 int t=1, x, res=0; 12 for(int i=0; i<k; i++) { 13 scanf("%d", &x); 14 if(t!=act[x]) { 15 t=act[x]; 16 ++res; 17 } 18 } 19 printf("%d\n", res); 20 } 21 return 0; 22 }
1 #include <stdio.h> 2 3 int main() 4 { 5 int T, n, m, k, tme[101], t; 6 scanf("%d", &T); 7 while(T--) { 8 scanf("%d%d%d", &n, &m, &k); 9 for(int i=1; i<=m; i++) 10 scanf("%d", tme+i); 11 for(int i=1; i<n; i++) 12 for(int j=1; j<=m; j++) { 13 scanf("%d", &t); 14 if(tme[j]>t) 15 tme[j]=t; 16 } 17 int res=0; 18 for(int i=0; i<k; i++) 19 scanf("%d", &t), 20 res+=tme[t]; 21 printf("%d\n", res); 22 } 23 return 0; 24 }
1 #include <stdio.h> 2 3 int main() 4 { 5 int T, m=1<<20; 6 char N[21]; 7 scanf("%d", &T); 8 while(T--) { 9 int x=0; 10 scanf("%s", N); 11 for(int i=0; i<20; i++) { 12 x<<=1; 13 if(N[i]=='5') 14 x|=1; 15 } 16 printf("%d\n", m-x); 17 } 18 return 0; 19 }
1 #include <stdio.h> 2 3 int main() { 4 int T, n, m; 5 scanf("%d", &T); 6 while(T--) { 7 scanf("%d%d", &n, &m); 8 printf("%.2lf\n", 1.*m*m/n+m-n-1E-7); 9 } 10 return 0; 11 }
1 #include <stdio.h> 2 #include <iostream> 3 using namespace std; 4 5 int main() { 6 int rd, A=0; 7 long double B=1; 8 cout.precision(0); 9 cout<<fixed; 10 while(~(rd=getchar())) { 11 if(rd=='\n') { 12 cout<<B<<endl; 13 A=0; B=1; 14 } 15 else if(rd=='+') 16 ++A; 17 else if(rd=='*') 18 B*=A; 19 } 20 return 0; 21 }
1 #include <iostream> 2 3 template<int N> struct czj { czj<N-1> oyk; czj() { std::cout << N << std::endl; } }; 4 5 template<> struct czj<0> { }; 6 7 czj<100> wwj; 8 9 int main() { }
1 #include <stdio.h> 2 #include <math.h> 3 4 int main() { 5 int T; 6 scanf("%d%*c", &T); 7 for(int cse=1; cse<=T; cse++) { 8 int r, a, b, c, x, y, z; 9 double res=.0; 10 printf("Case #%d: ", cse); 11 scanf("%*c%d,%d,%d%*c", &a, &b, &c); 12 while(r=getchar(), r!='\n') { 13 scanf("%*c%d,%d,%d%*c", &x, &y, &z); 14 a-=x; b-=y; c-=z; 15 res+=sqrt(a*a+b*b+c*c); 16 a=x; b=y; c=z; 17 } 18 printf("%.3f\n", res); 19 } 20 return 0; 21 }