發表文章

目前顯示的是 12月, 2010的文章

a012

#include using namespace std; int main(){ long long int a,b; while(cin >> a>> b){ if(a-b >= 0 ){ cout } else{ cout } } }

a011

#include #include using namespace std; int main(){ string input; int len=0; int num=0; bool t= false; int k; while(getline(cin, input)){ len = input.length(); num = 0; for(int i=0 ; i k = input[i]+1-1; if( (k>=48 && k =65 &&k =97 &&k t = true; } else{ if(t){ t = false; num++; } } } if(t){ num++; } cout t=false; } }

a010

#include<iostream> using namespace std; int main(){ int t,k=0; int prim[100]; int p_num[100]; int temp,temp2,p=2; bool isp=false; int z; while(cin>>temp){ while(p<=temp){ t=0; if(isp){ k++; isp=false; } while(temp%p == 0){ temp = temp/p; t++; prim[k]=p; p_num[k]=t; isp=true; } p++; }//while for(int i=0; i< k; i++){ cout<< prim[i]; if(p_num[i] != 1){ cout<< "^"<< p_num[i]<< " * "; } else{ cout<< " * "; } } ...

a009

#include<iostream> #include<string> using namespace std; int main(){ string input; string output; int len; while( cin>> input){ len = input.length(); output = input; for(int i=0; i< len; i++){ output[i] = input[i] - 7; } cout<< output<< endl; } }

a007

#include<iostream> #include<math.h> using namespace std; int main(){ int a,b; bool p=true; int test=2; while(cin>>a){ p = true; b = sqrt(a); if(a == 0 || a== 1){ cout<<"非質數"<< endl; } else if(a == 2){ cout<<"質數"<< endl; } else{ while(p){ if(( a%test) == 0){ p = false; cout<<"非質數"<< endl; } if(test>b){ p = false; cout<<"質數"<< endl; } test++; } } test = 2; }//while }

a008

自己co不出來 別人那抄來的 有BUG 但是AC了.... #include<iostream> using namespace std; char *unit[10]={"零","壹","貳","參","肆","伍","陸","柒","捌","玖",} ; char *table[3]={"仟","佰","拾"}; char *thr[4]={"萬","億","兆","京"}; void dis(char *s,int len){ int i,c = (len+3)/4,pos; i = (4-len%4)%4; do{ for( ; i<4 ; i++){ pos = len-c*4+i; if(s[ pos] ! = '0'){ printf("%s",unit[s[pos]-48]); if(i! = 3) printf("%s",table[i]); } else{ if( pos < len-1&&s[ pos+1]! = '0'&&i! = 3) printf("%s",unit[0]); } } if(c>1) printf("%s",thr[c-2]); i = 0; }while(--c); }//void int ...

對不起...

好久沒CO了 明天在CO 哈哈