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

10887

#include <iostream> #include <string> #include <string.h> #include <stdio.h> #include <sstream> #define SZ 10000017 using namespace std; char b[30]; char str[3000000][25];//3000000 int parent[10000017]; int strmap[3000000]; int gethash(char s[]) { int seed=31; int v=0; for(int i=0;i<strlen(s);i++) { v= v*seed+(s[i]-'0'); } return (v&0x7FFFFFFF)%SZ; } bool insert(int position) { int _hash = gethash(str[position]); int next=parent[_hash]; while(next!=-1) { if(!strcmp(str[position],str[next])) break;

11362

#include <iostream> #include <stdio.h> #include <vector> using namespace std; struct node{ bool endofmark; node *next[11]; node() { endofmark=false; for(int i=0;i<10;i++) next[i]=NULL; } }*root; int insert(string str) { node *curr=root; int id; int created=0; for(int i=0;i<str.size();i++) { id=str[i]-'0'; if(curr->next[id]==NULL) { curr->endofmark=false; curr->next[id]=new node(); created =1; } curr=curr->next[id]; } if(created==0) curr->endofmark=false; else curr->endofmark=true; return created; } bool

12506

#include <iostream> #include <string> #include <queue> using namespace std; int res; struct node{ int cont; node *next[26]; node() { cont=0; for(int i=0;i<26;i++) next[i]=NULL; } }*root; void insert(string s) { node *tmp= root; int len=s.size(); int idx; for(int i=0;i<len;i++) { idx= s[i]-'a'; if(tmp->next[idx]==NULL) tmp->next[idx]=new node(); tmp->next[idx]->cont++; tmp = tmp->next[idx]; } } void del(node *r) { for(int

12542

#include <stdio.h> #include <string.h> #include <string> #include <iostream> #include <math.h> #include <vector> #define SZ 100005 using namespace std; int prim[SZ]; vector<int> v; void primgen() { v.push_back(2); prim[2]=0; for(int i=3;i<SZ;i+=2) { if(prim[i]==0) { v.push_back(i); for(int j=i*3;j<SZ;j+=i) prim[j]=1; } } //cout<<v.size()<<"\n"; } int main() { int mult[5]; int m,max_; string s; primgen(); while(cin>>s) { if(s=="0") break; memset(mult,0,sizeof(mult));

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; }