摘要: #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 阅读(136) 评论(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 阅读(234) 评论(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 阅读(208) 评论(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 阅读(288) 评论(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 阅读(166) 评论(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 阅读(235) 评论(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 阅读(128) 评论(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 阅读(227) 评论(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 阅读(146) 评论(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 阅读(152) 评论(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 阅读(184) 评论(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 阅读(194) 评论(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 阅读(168) 评论(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 阅读(153) 评论(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 阅读(152) 评论(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 阅读(150) 评论(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 阅读(114) 评论(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 阅读(100) 评论(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 阅读(136) 评论(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 阅读(142) 评论(0) 推荐(0) 编辑