标签:har printf turn blog scanf put amp ret clu
1 #include<stdio.h> 2 char s[65550]; 3 int cus(int x,int y) 4 { 5 if(y) 6 cus(y,x%y); 7 else 8 return x; 9 } 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 scanf("%s",s); 15 int i,u,d; 16 for(i=u=d=0; i<n; ++i) 17 { 18 if(s[i]==‘S‘) 19 break; 20 else if(s[i]==‘U‘) 21 ++u; 22 else if(s[i]==‘D‘) 23 ++d; 24 } 25 double temp = 1.0*u/n; 26 int cnt=cus(u,n); 27 if(i<n) 28 puts("Bingo"); 29 else if(temp >= 0.497 && temp <= 0.503) 30 printf("%d/%d\n",u/cnt,n/cnt); 31 else 32 puts("Fail"); 33 return 0; 34 }
标签:har printf turn blog scanf put amp ret clu
原文地址:http://www.cnblogs.com/qq188380780/p/6358053.html