返回上一頁
121317許偉(2009-03-05 16:24:45)
#include using namespace std; int main() { string s; while(cin >> s){ cout << "Hello "<< s << endl; } return 0; }
121317許偉(2009-03-05 16:29:34)
#include using namespace std; int main() { int a; int b; while(cin >> a >>b){ cout << a+b << endl; } return 0; } /**********************************************************************************/ /* Problem: a002 "簡易加法" */ /* Language: C++ */ /* Result: AC (12ms, 870KB) on ZeroJudge */ /* Author: mike_types at 2009-02-12 16:02:07 */ /**********************************************************************************/ #include using namespace std; int main() { int a; int b; while(cin >> a >>b){ cout << a+b << endl; } return 0; }
121317許偉(2009-03-05 16:30:39)
#include using namespace std; int main() { int m; int d; int s; while(cin >> m >>d){ s=(m*2+d)%3; if(s<=1) { if(s==1) { cout <<"吉"<
121317許偉(2009-03-05 16:31:11)
#include using namespace std; int main() { int m; int s; while(cin >> m ) { if(m%4==0&&m%100!=0||m%400==0) { cout<<"閏年"< using namespace std; int main() { int m; int s; while(cin >> m ) { if(m%4==0&&m%100!=0||m%400==0) { cout<<"閏年"<
121317許偉(2009-03-05 16:31:39)
#include using namespace std; main() { int a,b,c,d,i,e ; cin>>a; for(i=1;i<=a;i++) { cin>>b>>c>>d>>e; if((c-b==d-c)&&(d-c==e-d)) { cout< using namespace std; main() { int a,b,c,d,i,e ; cin>>a; for(i=1;i<=a;i++) { cin>>b>>c>>d>>e; if((c-b==d-c)&&(d-c==e-d)) { cout<
121317許偉(2009-03-05 16:32:16)
#include #include using namespace std; int main() { double a,b,c,d; while(cin >> a >> b >> c){ d=(b*b)-(4*a*c) ; if(d<0){ cout << "No real root" < #include using namespace std; int main() { double a,b,c,d; while(cin >> a >> b >> c){ d=(b*b)-(4*a*c) ; if(d<0){ cout << "No real root" <a007 121317許偉(2009-03-05 16:32:59) #include #include using namespace std; main() { long i,x,n; double xyz; while(cin>>x){ xyz=sqrt((double)x); n=0; for(i=2;i<=xyz;i++){ if(x%i==0){ n=1; break; } } if (n==1){ cout<<"非質數"< a009 121317許偉(2009-03-05 16:33:27) # include using namespace std; int main() { int a,b,i; string s; while(getline(cin, s)) { for(int i=0;i d063 121317許偉(2009-03-05 16:53:16) #include using namespace std; int main(){ int A; cin>>A; if(A==1){ cout<<"0"<<"\n"; } if(A==0){ cout<<"1"<<"\n"; } system("pause"); } d064 121317許偉(2009-05-07 16:08:55) #include using namespace std; int main() { int a; while(cin>>a){ if(a%2==0) cout<<"Even"; if (a%2==1) cout<<"Odd";} system("pause"); return 0; } a008 121317許偉(2009-05-07 16:07:12) #include using namespace std; int math[10]; int num (int n){ if (n==1) cout<<"壹"; if (n==2) cout<<"貳"; if (n==3) cout<<"參"; if (n==4) cout<<"肆"; if (n==5) cout<<"伍"; if (n==6) cout<<"陸"; if (n==7) cout<<"柒"; if (n==8) cout<<"捌"; if (n==9) cout<<"玖"; } int math_che(int k){ int i; int j; for (i=9;i>=k;i--){ if (math[i]==1){ cout<<"零"; for(j=9;j>=k;j--){ math[j]=0; } break; } } } main(){ long int text; int check; int math_8=0; int math_4=0; int mark=0; int j; while(cin>>text){ for(j=9;j>=0;j--){ math[j]=0; } if (text/1000000000!=0){ num(text/1000000000); cout<<"拾"; math_8=1; mark=1; math[9]=1; } if ((text%1000000000)/100000000!=0){ num((text%1000000000)/100000000); math_8=1; mark=1; math[8]=1; } if (math_8==1) { cout<<"億"; } if ((text%100000000)/10000000!=0){ num((text%100000000)/10000000); cout<<"仟"; math_4=1; mark=1; math[7]=1; } if ((text%10000000)/1000000!=0){ if (mark==1 && math[7]!=1) math_che(8); num((text%10000000)/1000000); cout<<"佰"; math_4=1; mark=1; math[6]=1; } if ((text%1000000)/100000!=0){ if (mark==1 && math[6]!=1) math_che(7); num((text%1000000)/100000); cout<<"拾"; math_4=1; mark=1; math[5]=1; } if ((text%100000)/10000!=0){ if (mark==1 && math[5]!=1) math_che(6); num((text%100000)/10000); math_4=1; mark=1; math[4]=1; } if (math_4==1) { cout<<"萬"; } if ((text%10000)/1000!=0){ num((text%10000)/1000); cout<<"仟"; mark=1; math[3]=1; } if ((text%1000)/100!=0){ if (mark==1 && math[3]!=1) math_che(4); num((text%1000)/100); cout<<"佰"; mark=1; math[2]=1; } if ((text%100)/10!=0){ if (mark==1 && math[2]!=1) math_che(3); num((text%100)/10); cout<<"拾"; mark=1; math[1]=1; } if (text%10!=0){ if (mark==1 && math[1]!=1) math_che(2); num(text%10); mark=1; math[0]=1; } if (mark==1){ cout<
121317許偉(2009-03-05 16:32:59)
#include #include using namespace std; main() { long i,x,n; double xyz; while(cin>>x){ xyz=sqrt((double)x); n=0; for(i=2;i<=xyz;i++){ if(x%i==0){ n=1; break; } } if (n==1){ cout<<"非質數"<
121317許偉(2009-03-05 16:33:27)
# include using namespace std; int main() { int a,b,i; string s; while(getline(cin, s)) { for(int i=0;i
121317許偉(2009-03-05 16:53:16)
#include using namespace std; int main(){ int A; cin>>A; if(A==1){ cout<<"0"<<"\n"; } if(A==0){ cout<<"1"<<"\n"; } system("pause"); }
121317許偉(2009-05-07 16:08:55)
#include using namespace std; int main() { int a; while(cin>>a){ if(a%2==0) cout<<"Even"; if (a%2==1) cout<<"Odd";} system("pause"); return 0; }
121317許偉(2009-05-07 16:07:12)
#include using namespace std; int math[10]; int num (int n){ if (n==1) cout<<"壹"; if (n==2) cout<<"貳"; if (n==3) cout<<"參"; if (n==4) cout<<"肆"; if (n==5) cout<<"伍"; if (n==6) cout<<"陸"; if (n==7) cout<<"柒"; if (n==8) cout<<"捌"; if (n==9) cout<<"玖"; } int math_che(int k){ int i; int j; for (i=9;i>=k;i--){ if (math[i]==1){ cout<<"零"; for(j=9;j>=k;j--){ math[j]=0; } break; } } } main(){ long int text; int check; int math_8=0; int math_4=0; int mark=0; int j; while(cin>>text){ for(j=9;j>=0;j--){ math[j]=0; } if (text/1000000000!=0){ num(text/1000000000); cout<<"拾"; math_8=1; mark=1; math[9]=1; } if ((text%1000000000)/100000000!=0){ num((text%1000000000)/100000000); math_8=1; mark=1; math[8]=1; } if (math_8==1) { cout<<"億"; } if ((text%100000000)/10000000!=0){ num((text%100000000)/10000000); cout<<"仟"; math_4=1; mark=1; math[7]=1; } if ((text%10000000)/1000000!=0){ if (mark==1 && math[7]!=1) math_che(8); num((text%10000000)/1000000); cout<<"佰"; math_4=1; mark=1; math[6]=1; } if ((text%1000000)/100000!=0){ if (mark==1 && math[6]!=1) math_che(7); num((text%1000000)/100000); cout<<"拾"; math_4=1; mark=1; math[5]=1; } if ((text%100000)/10000!=0){ if (mark==1 && math[5]!=1) math_che(6); num((text%100000)/10000); math_4=1; mark=1; math[4]=1; } if (math_4==1) { cout<<"萬"; } if ((text%10000)/1000!=0){ num((text%10000)/1000); cout<<"仟"; mark=1; math[3]=1; } if ((text%1000)/100!=0){ if (mark==1 && math[3]!=1) math_che(4); num((text%1000)/100); cout<<"佰"; mark=1; math[2]=1; } if ((text%100)/10!=0){ if (mark==1 && math[2]!=1) math_che(3); num((text%100)/10); cout<<"拾"; mark=1; math[1]=1; } if (text%10!=0){ if (mark==1 && math[1]!=1) math_che(2); num(text%10); mark=1; math[0]=1; } if (mark==1){ cout<