摘要: #include<stdio.h>long abs(long x){ return x>0?x:-x;}int main(){ /**//* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ long n; scanf("%ld",&n); for(long cas=1;cas<=n;cas++) { long amp,fre; scanf("%ld%ld",& 阅读全文
posted @ 2012-04-28 12:29 open your eyes 阅读(137) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<stdlib.h>#define MAX_INT 2147483647char num1[300],num2[300];int main(){ char c; while (scanf("%s %c %s", num1, &c, num2)==3) { printf("%s %c %s\n", num1, c, num2); double a, b; a = atof(num1); b = atof(num2); if (a > ... 阅读全文
posted @ 2012-04-28 12:29 open your eyes 阅读(236) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <stdlib.h>#include <string.h>const int max=105;int main() { int i,j,k,han=0,len[max],maxlen=0; char a[max][max]; for (i=0;i<max;i++) { for (j=0;j<max;j++) { a[i][j]='\0'; } } i=0; while (gets(a[i])){ ... 阅读全文
posted @ 2012-04-28 12:28 open your eyes 阅读(211) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cstdio>#include<cstring>using namespace std;int flag,flag2;string sa;int find(char a){ int flag1=0; for(int i=0;i<sa.length();i++) { if(sa[i]==a) { sa[i]='*'; flag1++; flag2--; } } return ... 阅读全文
posted @ 2012-04-28 12:28 open your eyes 阅读(289) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cctype>#include<cstring>using namespace std;char s[100000];int main(){ while(cin.getline(s,100000)) { int sum=0,i=0; while(i<strlen(s)) { if(isalpha(s[i])&&!isalpha(s[i+1])) { sum++; ... 阅读全文
posted @ 2012-04-28 12:27 open your eyes 阅读(168) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>using namespace std;int a[1000+10],b[1000+10],temp[1000+10];bool is_break(int b[],int n){ int i,flag=0;; for(i=0;i<n;i++) { if(b[i]==0) flag++; } if(flag==n)return 1; else return 0;}int main(){ int n; int flag=1; while(c... 阅读全文
posted @ 2012-04-28 12:24 open your eyes 阅读(242) 评论(0) 推荐(0)
摘要: #include<iostream>#include<map>#include<string>using namespace std; int main(){ map<string ,int> m; int n; cin>>n; for(int i=0;i<n;i++) { string s; string t; cin>>s; m[s]++; getline(cin,t); } for(map<string,int>::iterator it=m.begin();it!=m.end... 阅读全文
posted @ 2012-04-28 12:24 open your eyes 阅读(133) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int n,m,i,temp,flag=1; while(cin>>m>>n) { if(m==0&&n==0)break; cout<<"CASE# "<<flag++<<":"<<endl; int a[10001]={0},b[10001]={0}; for(i=0;i<m;i++) { cin>>temp; a[temp]++; } 阅读全文
posted @ 2012-04-28 12:22 open your eyes 阅读(233) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int sum,flag=1; cin>>sum; while(sum--) { long long n,i=2; cin>>n; cout<<"Case #"<<flag++<<": "<<n<<" = "; int flag2=1; while(true) { if(n%i==0&&flag2==1) { cou... 阅读全文
posted @ 2012-04-28 12:16 open your eyes 阅读(151) 评论(0) 推荐(0)
摘要: #include<iostream>#include<vector>using namespace std;int main(){ long long n; while(cin>>n) { if(n<0)break; if(n==1)cout<<" "<<1<<endl; else { vector<long long>v; long long i=2; while(true) { if(i*i>n... 阅读全文
posted @ 2012-04-28 12:16 open your eyes 阅读(155) 评论(0) 推荐(0)
摘要: #include<iostream>#include <algorithm>#include<vector>using namespace std;int main(){ int Z,I,M,L,flag=1; while(cin>>Z>>I>>M>>L) { if(Z==0&&I==0&&M==0&&L==0)break; int temp,temp2,i=0; temp=Z*L+I; vector<int>v; v.push_back(L); wh 阅读全文
posted @ 2012-04-28 12:15 open your eyes 阅读(172) 评论(0) 推荐(0)
摘要: #include<iostream>#include<iomanip>using namespace std;int main(){ int m,n; while(cin>>m>>n) { cout<<setw(10)<<right<<m<<setw(10)<<right<<n<<" "; int temp1=1,temp2,temp3; temp2=m>n?m:n; temp3=m<n?m:n; while(temp1) { te 阅读全文
posted @ 2012-04-28 12:15 open your eyes 阅读(197) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int n; while(cin>>n) { if(n==0) cout<<" "<<0<<" -> "<<1<<endl; else { int i,temp=1; for(i=1;i<=n;i++) { temp=temp*i; while(temp%10==0) temp=temp/10; ... 阅读全文
posted @ 2012-04-28 12:15 open your eyes 阅读(188) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>using namespace std;int main(){ int a,b,c; while(cin>>a>>b>>c) { int yushu=0; int i,temp=b,temp1; for(i=1;;i++) { if((b*c+yushu)!=temp) { temp1=yushu; yushu=(b*c+yushu)/a; ... 阅读全文
posted @ 2012-04-28 12:14 open your eyes 阅读(156) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>using namespace std;int main(){ long long n; while(cin>>n) { if(n==0)break; long long flag; flag=(int)sqrt((double)n); if(flag*flag==n) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0;} 阅读全文
posted @ 2012-04-28 12:14 open your eyes 阅读(160) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cmath>using namespace std;int main(){ string s; while(cin>>s) { if(s=="0")break; int len=s.length(),i; long long sum=0; for(i=len;i>0;i--) { sum+=(s[len-i]-'0')*((int)pow(2.0,i*1.0)-1); } ... 阅读全文
posted @ 2012-04-28 12:13 open your eyes 阅读(117) 评论(0) 推荐(0)
摘要: #include<iostream>#include<iomanip>using namespace std;#define MAXN 10010int main(){ double c[MAXN]; double a,b; int cases,n; cin>>cases; while(cases--) { cin>>n>>a>>b; double sum=0,tmp=0; for(int i=0;i<n;i++) { cin>>c[i]; } tmp=... 阅读全文
posted @ 2012-04-28 12:13 open your eyes 阅读(157) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int m,n; while(cin>>m>>n) { cout<<m*n-1<<endl; } return 0;} 阅读全文
posted @ 2012-04-28 12:12 open your eyes 阅读(108) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>using namespace std;int main(){ long long n; while(cin>>n) { if(n==0)break; n=(n-1960)/10+2; double flag1=pow(2.0,n+0.0)*log10(2.0); double flag2=0.0; for(int i=1;;i++) { flag2+=log10(i+0.0); i... 阅读全文
posted @ 2012-04-28 12:11 open your eyes 阅读(143) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>using namespace std;int main(){ int n; while(cin>>n) { unsigned long long a[10]={0}; int i,j; for(i=1;i<=n;i++) { a[0]+=i*i; } a[1]=(n*(n+1)/2)*(n*(n+1)/2); a[1]=a[1]-a[0]; for(i=1;i<=n;i++)... 阅读全文
posted @ 2012-04-28 12:11 open your eyes 阅读(139) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int sum; cin>>sum; while(sum--) { int m,n; int flag1,flag2; cin>>m>>n; flag1=m/3; flag2=n/3; cout<<flag1*flag2<<endl; } return 0;} 阅读全文
posted @ 2012-04-28 12:10 open your eyes 阅读(80) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ long long m,n,flag=1; while(cin>>m>>n) { if(m==0&&n==0)break; long long sum=0; sum=m*(m-1)*n*(n-1)/4; cout<<"Case "<<flag++<<": "<<sum<<endl; }} 阅读全文
posted @ 2012-04-28 12:10 open your eyes 阅读(122) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>using namespace std;int main(){ int k; int a[10010]; int b[10010]={0}; while(cin>>k) { int flag=0,j,r,temp; char c; while(scanf("%d%c",&temp,&c)==2) { a[flag++]=temp; if(c=='\n')break; } ... 阅读全文
posted @ 2012-04-28 12:10 open your eyes 阅读(137) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>using namespace std;int main(){ int n; double s; while(cin>>n) { if(n<0)break; if(n<=1)s=0; else s=n; s=s*25.0; printf("%.lf%%\n",s); } return 0;} 阅读全文
posted @ 2012-04-28 12:09 open your eyes 阅读(120) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int H,U,D,F; while(cin>>H>>U>>D>>F) { if(H==0)break; int i; double temp=double(U)*(F/100.0); double sum=U; for(i=1;;i++) { if(sum>H) { cout<<"success on day "<<i... 阅读全文
posted @ 2012-04-28 12:09 open your eyes 阅读(158) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int sum; cin>>sum; while(sum--) { int m,n,i; cin>>m>>n; int dis=n-m; if(dis==0) cout<<"0"<<endl; else { for(i=0;;i++) { if(dis==i*i) ... 阅读全文
posted @ 2012-04-28 12:09 open your eyes 阅读(143) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int n; cin>>n; cin.ignore(); while(n--) { long long a; cin>>a; cin.ignore(); if(a<0) a=-a; if(a==0) cout<<"3"<<endl; else { long long temp=0; ... 阅读全文
posted @ 2012-04-28 12:08 open your eyes 阅读(171) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int n,v=1; while(cin>>n) { cin.ignore(); if(n==0)break; int i,j,a[60],sum=0; for(i=0;i<n;i++) { cin>>a[i]; cin.ignore(); sum+=a[i]; } sum=sum/n; int fla... 阅读全文
posted @ 2012-04-28 12:08 open your eyes 阅读(119) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>using namespace std;int main(){ int m,n; while(cin>>m>>n) { if(m==0&&n==0)break; if(m==n&&n==1) cout<<"0 1"<<endl; else { int k=1; for(k=1;;k++) { if((int)(pow(1+pow(n,1.0... 阅读全文
posted @ 2012-04-28 12:08 open your eyes 阅读(235) 评论(0) 推荐(0)
摘要: #include<iostream>#include<map>#include<string>using namespace std;int main(){ string s; while(getline(cin,s)) { string sa,sb; sa=s.substr(0,6); sb=s.substr(6,6); } return 0;} 阅读全文
posted @ 2012-04-28 12:07 open your eyes 阅读(194) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>using namespace std;int main(){ int n; cin>>n; cin.ignore(); while(n--) { string m; getline(cin,m); if(m.compare("78")==0||m.compare("1")==0||m.compare("4")==0) cout<<"+"<<endl; else if(m[m.length 阅读全文
posted @ 2012-04-28 12:07 open your eyes 阅读(192) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstdio>#include<cmath>using namespace std;int main(){ double n,p; double temp; while(scanf("%lf%lf",&n,&p)==2) { temp=pow(p,1/n); printf("%.lf\n",temp); } return 0;} 阅读全文
posted @ 2012-04-28 12:06 open your eyes 阅读(166) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int m; while(cin>>m) { if(m==0)break; if(m==1)cout<<"1 1"<<endl; else { int i,x=1,y=1; for(i=1;;i++) { if(m>=(i*i+1)&&m<=((i+1)*(i+1))) { ... 阅读全文
posted @ 2012-04-28 12:06 open your eyes 阅读(156) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<cstring>#include<cstdio>using namespace std;const int MAXN=1000;class BigNumber{public: int len,s[MAXN];public: void cleanLeadZero(); void multiplyTen(int n); void divisionTen(int n); string str() const; BigNumber(); BigNumber(int n) 阅读全文
posted @ 2012-04-28 12:03 open your eyes 阅读(606) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cctype>#include<algorithm>#include<string>#include<map>using namespace std;int main(){ map <char,char> ch_in; ch_in.insert(make_pair('A','2')); ch_in.insert(make_pair('B','2')); ch_in.insert(make_pair(' 阅读全文
posted @ 2012-04-28 12:02 open your eyes 阅读(243) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<algorithm>#include<cstdio>using namespace std;const string kStr("AJAJAJAJAJASASASASASABABABABABAKAKAKAKAKATUTUTUTUTUCUCUCUCUCULULULULULUDUDUDUDUDUMUMEMEMEMEVEVEVEVEVENENENENENEWEWEWEWEWEFEFEFOFOFOXOXOXOXOXOGOGOGOGOGOPOPOPOPOPOYO 阅读全文
posted @ 2012-04-28 12:02 open your eyes 阅读(172) 评论(0) 推荐(0)
摘要: #include<string>#include<iostream>#include<set>#include<cctype>#include<map>using namespace std;int main(){ string temp; set<string>no_key; multimap<string,string>key_title; while(getline(cin,temp)&&temp!="::") no_key.insert(temp); int temp 阅读全文
posted @ 2012-04-28 12:01 open your eyes 阅读(195) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>#include<algorithm>#include<cctype>using namespace std;struct Team{ string name; int team_rank; int total_point; int game_played; int wins; int ties; int losses; int goal_difference; int goal_scored; int goal_against; Team():name("" 阅读全文
posted @ 2012-04-28 12:01 open your eyes 阅读(175) 评论(0) 推荐(0)
摘要: #include<iostream>#include<vector>#include<map>#include<cctype>#include<algorithm>#include<string>#include<cstring>using namespace std;string to_lower(const string s){string temp;for(int i=0;i<s.length();i++)temp[i]=tolower(s[i]);return temp;}bool is_equa 阅读全文
posted @ 2012-04-28 12:00 open your eyes 阅读(194) 评论(0) 推荐(0)
摘要: #include<iostream>#include<vector>#include<string>#include<algorithm>using namespace std;int main(){ int n,i,j; while(cin>>n) { vector<string> vs; int max_len=0,col=1,hang=0; string temp; for(i=0;i<n;i++) { cin>>temp; vs.push_back(tem... 阅读全文
posted @ 2012-04-28 12:00 open your eyes 阅读(265) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int n,i,j; cin>>n; while(n--) { int m,train[60],sum=0; cin>>m; for(i=0;i<m;i++) cin>>train[i]; for(i=0;i<m;i++) { for(j=i+1;j<m;j++) { if(train[i]>train[j]... 阅读全文
posted @ 2012-04-28 11:59 open your eyes 阅读(200) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstring> #include<string> #include<cstdio> #include<fstream> #define maxn 10010 using namespace std; int n; char m[maxn]; int mmm=0; void add(char *n1,char *n2,char *re) //两数相加,结果存在re里面 { int i=0,j=0; int len1=strlen(n1); int len2=strlen(n2); 阅读全文
posted @ 2012-04-28 11:54 open your eyes 阅读(184) 评论(0) 推荐(0)
摘要: #include<iostream>using namespace std;int main(){ int flag=1; long m,n; while(cin>>m>>n) { if(m==-1&&n==-1) break; long temp=1; cout<<"Case "<<flag<<": A = "<<m<<", limit = "<<n<<", number of terms 阅读全文
posted @ 2012-04-28 11:54 open your eyes 阅读(155) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>using namespace std;int main(){ string s[10]; string ss; int set=0,sum=0; while(cin>>ss) { cin.ignore(); if(ss=="9") { set++; int i,j,flag=0; for(i=0;i<sum;i++) { for(j=0;... 阅读全文
posted @ 2012-04-28 11:54 open your eyes 阅读(181) 评论(0) 推荐(0)
摘要: #include <iostream>#include<cstdio>//#include <string.h>#include <cstring>using namespace std;char str[55][55];int m,n;char bin[55];int dir[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,0,1,-1,1,1};bool _strcmp (char *p,char *q){ int len = strlen (p); for (int i = 0; i < len; i++) i 阅读全文
posted @ 2012-04-28 11:52 open your eyes 阅读(249) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>#include<cstdio>#include<cctype>using namespace std;char a[100][100];char s[]={"the quick brown fox jumps over the lazy dog"};char change[100];int ifFind(char a[]) { int i; int vis[100]; int ok=1; memset(vis,0,sizeof(vis)); for(i=0 阅读全文
posted @ 2012-04-28 11:52 open your eyes 阅读(282) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cmath>#include<algorithm>#include<vector>using namespace std;int main(){ int n; while(cin>>n) { vector<int> a(3000); vector<int> b(3000); cin>>a[0]; for(int i=1;i<n;i++) { cin>>a[i]; b[i]=abs(a[i]-a[i-1]);... 阅读全文
posted @ 2012-04-28 11:51 open your eyes 阅读(211) 评论(0) 推荐(0)
摘要: #include<iostream>#include<cstring>using namespace std;char a[100]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";int main(){ char ch[1000]; while(cin.getline(ch,1000)) { for(int i=0;i<strlen(ch);i++) { if(isgraph(ch[i])&&!isdigit(ch[i])) { ... 阅读全文
posted @ 2012-04-28 11:50 open your eyes 阅读(145) 评论(0) 推荐(0)
摘要: #include<iostream>#include<vector>#include<cmath>#include<cstring>#include<algorithm>using namespace std;int main(){ int n,a[600]; cin>>n; while(n--) { int m,i; cin>>m; vector<int> sum(m,0); for(i=0;i<m;i++) { cin>>a[i]; } for(i... 阅读全文
posted @ 2012-04-28 11:50 open your eyes 阅读(98) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <string.h>char a[300]={'\0'},b[300]={'\0'};int mult[610]={0},na[300]={0},la,nb[300]={0},lb;int main(){ int i,j; while(scanf("%s%s",a,b)==2) { la=strlen(a); lb=strlen(b); for(i=0;i<la;i++) na[i]=a[la-1-i]-'0'; for(j=0;j<lb 阅读全文
posted @ 2012-04-28 11:49 open your eyes 阅读(169) 评论(0) 推荐(0)
摘要: 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 int main() 5 { 6 int n,i; 7 string sa,a,b; 8 string s[100],ss[100]; 9 while(cin>>n)10 {11 if(n==0)break;12 cin.ignore();13 for(i=0;i<n;i++)14 {15 getline(cin,s[i]);16 ... 阅读全文
posted @ 2012-04-28 11:46 open your eyes 阅读(132) 评论(0) 推荐(0)