#include <iostream> #include <cstdlib> #include <cstdio> #define SZ 10005 #define INF 100000000 #define ll long long using namespace std; ll a[SZ]; int main() { ll N,M,MN; bool f=0; ll price2,price1; price2 = 1000001; price1 = 1000001; int d = price1+price2; //cout<<d<<"\n"; while(cin>>N) { MN = INF; for(int i=0;i<N;i++) cin>>a[i]; cin>>M; for(int i=0;i<N;i++) { for(int j=0;j<N;j++)
Category: Ad Hoc
10044
#include <iostream> #include <string.h> #include <string> #include <vector> #include <cstdio> #include <map> #define ll long long #define MAX_WORD 105 #define INF 100000000 using namespace std; int min_arr[1000001]; map<string,int> nameErdos; int minval(string **vb,int i) { int v = nameErdos[0]]; for(int j=1;vb[i][j]!="END";j++) { v = min(v,nameErdos[j]]); } return v; } int main() { int t,P,N,MN; int kase=1;
10409
#include <iostream> #include <cstring> #include <string> #include <vector> #include <fstream> #include <map> #define INF 1000000000 using namespace std; int T,B,W,E,S,N; int Prev_T,Prev_N,Prev_B,Prev_S,Prev_W,Prev_E; int main() { int n; string cmd; while(cin>>n) { if(n==0) break; T=1;N=2;W=3; B=6;S=5;E=4; while(n–) { cin>>cmd; if(cmd=="north") { Prev_T=T;Prev_N=N;Prev_B=B;Prev_S=S; Prev_W=W;Prev_E=E; T = Prev_S; N = Prev_T;W=Prev_W; B = Prev_N;S=Prev_B;E=Prev_E; } else if(cmd=="south") {
1189
#include <stdio.h> int main() { int n,t; while(scanf("%d",&n)) { if(n==0) break; int c[205]={}; t = 1%n; int i=0; while(1) { i++; if(c[t]) { for(int j=c[t];j<i;j++) printf("1"); for(int j=c[t]-1;j>=0;j–) printf("0"); printf("\n"); break; } c[t]=i; t =(t*10+1)%n; } } return 0; }
490
#include <iostream> #include <string.h> #include <fstream> using namespace std; char s[105][105]; int main() { int k=0; int len,mx=0; //ofstream out; //out.open("out.txt"); for(int i=0;i<105;i++) for(int j=0;j<105;j++) s[i][j]=' '; while(gets(s[k])) { len = strlen(s[k]); s[k][len] =' '; if(len>mx) mx = len; k++; } for(int j=0;j<mx;j++) { for(int i=k-1;i>=0;i–) { cout<<s[i][j]; //out<<s[i][j]; } cout<<endl; //out<<endl; } //out.close(); return
12403
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int t,n; char str[100],s[20]; cin>>t; getchar(); int sum=0; while(t–) { gets(str); if(strcmp(str,"report")==0) { sprintf(s,"%d",sum); puts(s); } else { sscanf(str,"%s %d",s,&n); sum+=n; } } return 0; }
12578
#include <iostream> #include <string.h> #include <stdio.h> #include <math.h> #define lld long long using namespace std; int main() { int t; double PI; double l,r,A,C,w; cin>>t; PI= acos(- 1); while(t–) { cin>>l; r=l/5; w= (6*l)/10; A = w*l; C= PI*r*r; A -=C; printf("%.2lf %.2lf\n",C,A); } return 0; }
12577
#include <iostream> #include <string.h> #include <stdio.h> #include <math.h> #define lld long long using namespace std; int main() { string s; int kase=1; while(cin>>s) { if(s=="*") break; if(s=="Hajj") cout<<"Case "<<kase++<<": Hajj-e-Akbar\n"; else if(s=="Umrah") cout<<"Case "<<kase++<<": Hajj-e-Asghar\n"; } return 0; }
12531
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; while(cin>>n) { if(n%6==0) printf("Y\n"); else printf("N\n"); } return 0; }
12502
/**********12502**********/ #include <iostream> #include <string.h> #include <stdio.h> #include <math.h> #define lld long long using namespace std; int main() { int t;//a= 2/15 b=1/12 double x,y,z; double extra,avg; cin>>t; while(t–) { cin>>x>>y>>z; avg=(x+y)/3; extra = x-avg; printf("%.0lf\n",(extra*z)/avg); } return 0; }