"; print " �Ʒ� ������ ������ ��� �п� ���� ����Դϴ�.
������ �غ����� ���ǰ��翡�� ������ �ֽñ� �ٶ��ϴ�.
"; print "
���� : o - Accepted, x - Wrong Answer, s - signal out(runtime error), t - Time Limit Exceeded


"; print "7ȸ ���� �ڴ���!! ���

"; print "
Gold Medal - �� ���̶� ������ �������� 10%, Silver Medal - �������� 20%, Bronze Medal - �������� 30%

"; print " : wdyd2004
"; print " : wdyd2004, gs12065, dijkstra
"; print " : gs11028, gs11008, gs11103, gs11103, gs12059
"; print " : k5888200, teram, admin, wclee2265, gs11059, gs11048, kk1401, byeonbi, ish94, gs11032

"; $dir="/var/www/bbs/moi/7thchk/"; $pnum = 5; $files1 = scandir($dir); $number=1; $iuser = array(); $ip1 = array(); $ip2 = array(); $ip3 = array(); $ip4 = array(); $ip5 = array(); $isc = array(); $rank = array(); for( $i=0 ; $files1[$i] != NULL ; $i++ ) { if(/*$files1[$i]!="admin" && */$files1[$i]!="." && $files1[$i]!=".." && is_dir($files1[$i])==true) { $number++; $score=0; if( $number%2 == 1 ) $bcolor = "ffffff"; else $bcolor = "ececff"; $id_name=""; for($ttt=0;$ttt<= strlen($files1[$i]) ;$ttt++) if(1<=$ttt&&$ttt<=-2) $id_name.= "*"; else $id_name.=SUBSTR($files1[$i],$ttt,1); $iuser[$number] = $id_name; for( $j=1 ; $j <= $pnum ; $j++ ) { $sz = 20; $prob_result = $dir.$files1[$i].'/'.$files1[$i].'.res'.$j; if(file_exists($prob_result)==true) { $score+=($j*0.001); $fp = fopen($prob_result, "r"); $str = fgets($fp, filesize($prob_result)+1); $resres = ""; for( $k=0; $k <= strlen($str) ; $k++ ) if(SUBSTR($str, $k, 1)== "o"){ $resres.=''.SUBSTR($str, $k, 1).''; if($j==1) $score += 20+($j*0.001); else if($j==2) $score += 20+($j*0.001); else if($j==3) $score += 20+($j*0.001); else if($j==4) $score += 20+($j*0.001); else if($j==5) $score += 20+($j*0.001); } else if(SUBSTR($str, $k, 1)=="x") $resres.=''.SUBSTR($str, $k, 1).''; else if(SUBSTR($str, $k, 1)=="t") $resres.=''.SUBSTR($str, $k, 1).''; else if(SUBSTR($str, $k, 1)=="s") $resres.=''.SUBSTR($str, $k, 1).''; } else $resres='Not submited!!'; if($j==1) $ip1[$number] = $resres; else if($j==2) $ip2[$number] = $resres; else if($j==3) $ip3[$number] = $resres; else if($j==4) $ip4[$number] = $resres; else $ip5[$number] = $resres; } $isc[$number]=$score; } } for($i=2;$i<=$number;$i++) for($j=2;$j<=$number;$j++) if( $isc[$i] < $isc[$j] ) $rank[$i]++; for($i=2;$i<=$number-1;$i++) for($j=$i+1;$j<=$number;$j++) if($isc[$i] < $isc[$j]) { $tttt=$iuser[$i];$iuser[$i]=$iuser[$j];$iuser[$j]=$tttt; $tttt=$ip1[$i];$ip1[$i]=$ip1[$j];$ip1[$j]=$tttt; $tttt=$ip2[$i];$ip2[$i]=$ip2[$j];$ip2[$j]=$tttt; $tttt=$ip3[$i];$ip3[$i]=$ip3[$j];$ip3[$j]=$tttt; $tttt=$ip4[$i];$ip4[$i]=$ip4[$j];$ip4[$j]=$tttt; $tttt=$ip5[$i];$ip5[$i]=$ip5[$j];$ip5[$j]=$tttt; $ttttt=$isc[$i];$isc[$i]=$isc[$j];$isc[$j]=$ttttt; $ttttt=$rank[$i];$rank[$i]=$rank[$j];$rank[$j]=$ttttt; } print 'Result for All Participant (������ ��쿡 5, 4, 3, 2, 1�� ������ ���� ������ �켱������ �������ϴ�.)
'; for($i=2; $i <= $number ; $i++ ) { if( $i%2 == 1 ) $bcolor = "ffffff"; else $bcolor = "ececff"; print ' '; print ' '; print ' '; print ' '; print ' '; print ' '; print ' '; print ''; print ""; } print "
Rank user Robo-K(200) Postfix Equation(200) S Pizza(200) Explosion(200) Bingo Card(200) Score
'.($rank[$i]+1).''.$iuser[$i].''.$ip1[$i].''.$ip2[$i].''.$ip3[$i].''.$ip4[$i].''.$ip5[$i].''.(floor($isc[$i])).'

"; print "�̹� ��ȸ�� �����Ͻ� ".($number)."�� ��� �����ϼ̽��ϴ�!! ���� �濬�� ����ϼ���~
"; print "������ ��ȸ�� �ȴٸ� ����ǰ�� �غ��� ^^;"; print "


Here is some User's perfact Solution!!


1. Robo-K (by gs12065)"; print '
  1. #include <stdio.h>  
  2.   
  3. int n, m, k, t, now;  
  4. long long sum, mul=1;  
  5. bool dir;  
  6.   
  7. int main(){  
  8.     scanf("%d%d%d", &n, &m, &k);  
  9.   
  10.     int i;  
  11.     for(i=0; i<m; i++){  
  12.         scanf("%d", &t);  
  13.         now+=dir?-1:1;  
  14.         if(now == 0) now = n;  
  15.         if(now > n) now = 1;  
  16.   
  17.         if(t == 10001) dir = !dir;  
  18.         else if(t == 10002) mul *= 2;  
  19.         else{  
  20.             sum += t*mul;  
  21.             if(sum%11 == 0 || sum >= k) break;  
  22.             mul = 1;  
  23.         }  
  24.     }  
  25.   
  26.     if(i == m) printf("0\n");  
  27.     else printf("%d\n", now);  
  28.   
  29.     return 0;  
  30. }  

'; print "


2. Postfix Equation (by gs11008) "; print '
  1. #include<stdio.h>         
  2. #include<stack>  
  3. using namespace std;  
  4. int a[2000030],index,dap;  
  5. char s[4000005];  
  6.                                                             // Last case is TLE  
  7. int calc(int a,int b,int c){  
  8.     if(b==-2)return a+c;  
  9.     if(b==-3)return a-c;  
  10.     if(b==-4)return a*c;  
  11.     return a/c;  
  12. }  
  13.   
  14.   
  15. int huwhi(int p,int q){  
  16.     int i;  
  17.     stack<int> S;  
  18.     for(i=p;i<=q;i++){  
  19.         if(a[i]>=0)  
  20.             S.push(a[i]);  
  21.         else{  
  22.             int x,y;  
  23.             y=S.top();  
  24.             S.pop();  
  25.             x=S.top();  
  26.             S.pop();  
  27.             S.push(calc(x,a[i],y));  
  28.         }  
  29.     }  
  30.     return S.top();  
  31. }  
  32. int f(int p,int q){  
  33.     int chk=0,flag=0,i;  
  34.     for(i=q-1;i>=p&&chk!=1;i--){  
  35.         if(a[i]==-1)flag=1;  
  36.         if(a[i]>=-1)chk++;  
  37.         else chk--;  
  38.     }  
  39.     if(a[q]==-2){  
  40.         if(flag==0){  
  41.             dap-=huwhi(i+1,q-1);  
  42.             f(p,i);  
  43.         }  
  44.         else{  
  45.             dap-=huwhi(p,i);  
  46.             f(i+1,q-1);  
  47.         }  
  48.     }  
  49.     else if(a[q]==-3){  
  50.         if(flag==0){  
  51.             dap+=huwhi(i+1,q-1);  
  52.             f(p,i);  
  53.         }  
  54.         else{  
  55.             dap=huwhi(p,i)-dap;  
  56.             f(i+1,q-1);  
  57.         }  
  58.     }  
  59.     else if(a[q]==-4){  
  60.         if(flag==0){  
  61.             dap/=huwhi(i+1,q-1);  
  62.             f(p,i);  
  63.         }  
  64.         else{  
  65.             dap/=huwhi(p,i);  
  66.             f(i+1,q-1);  
  67.         }  
  68.     }  
  69.     else if(a[q]==-5){  
  70.         if(flag==0){  
  71.             dap*=huwhi(i+1,q-1);  
  72.             f(p,i);  
  73.         }  
  74.         else{  
  75.             dap=huwhi(p,i)/dap;  
  76.             f(i+1,q-1);  
  77.         }  
  78.     }  
  79.     return 0;  
  80. }  
  81.   
  82. int main(){  
  83.     int i;  
  84.     for(;scanf("%s",s);){  
  85.         if(s[0]=='x'){  
  86.             a[index++]=-1;  
  87.             continue;  
  88.         }  
  89.         else if(s[0]=='+'){  
  90.             a[index++]=-2;  
  91.             continue;  
  92.         }  
  93.         else if(s[0]=='-'){  
  94.             a[index++]=-3;  
  95.             continue;  
  96.         }  
  97.         else if(s[0]=='*'){  
  98.             a[index++]=-4;  
  99.             continue;  
  100.         }  
  101.         else if(s[0]=='/'){  
  102.             a[index++]=-5;  
  103.             continue;  
  104.         }  
  105.         else if(s[0]=='=')break;  
  106.         int d=0;  
  107.         i=0;  
  108.         while(1){  
  109.             if(s[i]=='\0')break;  
  110.             d*=10;  
  111.             d+=s[i]-'0';  
  112.             i++;  
  113.         }  
  114.         a[index++]=d;  
  115.     }  
  116.     int d=0;  
  117.     scanf("%d",&dap);  
  118.     f(0,index-1);  
  119.     printf("%d",dap);  
  120. }  

'; print "


Here is another solution (by gs12065)
"; print '
  1. #include <stdio.h>  
  2. #include <stack>  
  3.                          // case 5, 7 is runtime error  
  4. struct number {  
  5.     long long s, sx;  
  6.     long long m, mx;  
  7. } tp, f, s;  
  8.   
  9. char c[30];  
  10. int res;  
  11. long long g;  
  12. std::stack < number > st;  
  13.   
  14. long long gcd(long long a, long long b){  
  15.     long long t;  
  16.     while(b>0){  
  17.         t = b;  
  18.         b = a%b;  
  19.         a = t;  
  20.     }  
  21.     return a;  
  22. }  
  23.   
  24. int main(){  
  25.     int i, t;  
  26.     while(scanf("%s", c)){  
  27.         if(c[0] == 'x'){  
  28.             tp.s = 0;  
  29.             tp.sx = 1;  
  30.             tp.m = 1;  
  31.             tp.mx = 0;  
  32.             st.push(tp);  
  33.         } else if(c[0] == '=') {  
  34.             scanf("%d", &res);  
  35.             tp = st.top();  
  36.             break;  
  37.         } else if(c[0] >= '0' && c[0] <= '9') {  
  38.             t = c[0]-'0';  
  39.             for(i=1; c[i]!=0; i++){  
  40.                 t *= 10;  
  41.                 t += c[i]-'0';  
  42.             }  
  43.             tp.s = t;  
  44.             tp.sx = 0;  
  45.             tp.m = 1;  
  46.             tp.mx = 0;  
  47.             st.push(tp);  
  48.         } else {  
  49.             s = st.top();  
  50.             st.pop();  
  51.             f = st.top();  
  52.             st.pop();  
  53.             if(c[0] == '-' || c[0] == '+'){  
  54.                 if(f.mx){  
  55.                     g = s.m/gcd(gcd(f.m, f.mx), s.m);  
  56.                     f.m *= g;  
  57.                     f.mx *= g;  
  58.                     f.s *= g;  
  59.                     f.sx *= g;  
  60.                     s.sx = s.s*f.mx/s.m;  
  61.                     s.s = s.s*f.m/s.m;  
  62.                 } else if(s.mx){  
  63.                     g = f.m/gcd(gcd(s.m, s.mx), f.m);  
  64.                     s.m *= g;  
  65.                     s.mx *= g;  
  66.                     s.s *= g;  
  67.                     s.sx *= g;  
  68.                     f.sx = f.s*s.mx/f.m;  
  69.                     f.s = f.s*s.m/f.m;  
  70.                 } else {  
  71.                     g = f.m*s.m/gcd(f.m, s.m);  
  72.                     f.s *= g/f.m;  
  73.                     f.sx *= g/f.m;  
  74.                     s.s *= g/s.m;  
  75.                     s.sx *= g/s.m;  
  76.                     f.m = s.m = g;  
  77.                 }  
  78.                 tp.m = f.m;  
  79.                 tp.mx = f.mx;  
  80.                 if(c[0] == '-'){  
  81.                     tp.s = f.s-s.s;  
  82.                     tp.sx = f.sx-s.sx;  
  83.                 } else if(c[0] == '+'){  
  84.                     tp.s = f.s+s.s;  
  85.                     tp.sx = f.sx+s.sx;  
  86.                 }  
  87.                 st.push(tp);  
  88.             } else if(c[0] == '*'){  
  89.                 tp.m = f.m*s.m;  
  90.                 tp.mx = f.mx*s.m+f.m*s.mx;  
  91.                 tp.s = f.s*s.s;  
  92.                 tp.sx = f.sx*s.s+f.s*s.sx;  
  93.                 st.push(tp);  
  94.             } else if(c[0] == '/'){  
  95.                 tp.m = f.m*s.s;  
  96.                 tp.mx = f.mx*s.s+f.m*s.sx;  
  97.                 tp.s = f.s*s.m;  
  98.                 tp.sx = f.sx*s.m+f.s*s.mx;  
  99.                 st.push(tp);  
  100.             }  
  101.         }  
  102.     }  
  103.     tp = st.top();  
  104.     printf("%lld\n", (tp.m*res-tp.s)/(tp.sx-tp.mx*res));  
  105.     return 0;  
  106. }  

'; print "


3. Special Pizza (by gs11103)
"; print'
  1. #include <stdio.h>  
  2. long long int M;  
  3. long long int C[55], p[55];  
  4. int ncr(int n, int r){  
  5.     long long int j,t=n,s=1;  
  6.     for(j=1;j<=r;j++){  
  7.         s=s*t/j;  
  8.         t--;  
  9.         C[j]=s;  
  10.     }  
  11.     return 0;  
  12. }  
  13. int pizza(int n, int k){  
  14.     if(k==0) return 0;  
  15.     long long int j,res1=1,res2=1;  
  16.     for(j=1;j<=n;j++) res1=(res1*(k-1))%M;  
  17.     if(n%2==0) res2=(k-1)%M;  
  18.     else res2=(1-k)%M;  
  19.     if((res1+res2)%M<0) return ((res1+res2)%M)+M;  
  20.     else return (res1+res2)%M;  
  21. }  
  22.   
  23. int main(){  
  24.     long long int n,k,i,res;  
  25.     scanf("%lld%lld%lld",&n,&k,&M);  
  26.     if(n==1){  
  27.         if(k==1){  
  28.             printf("%lld",1%M);  
  29.             return 0;  
  30.         }  
  31.         else{  
  32.             printf("0");  
  33.             return 0;  
  34.         }  
  35.     }  
  36.     if(n<k){  
  37.         printf("0");  
  38.         return 0;  
  39.     }  
  40.     for(i=k;i>=0;i--){  
  41.         p[i]=pizza(n,i);  
  42.     }  
  43.     for(i=1;i<=k;i++) C[i]%=M;  
  44.     res = p[k];  
  45.     ncr(k,k);  
  46.     C[0]=1;  
  47.     for(i=k-1;i>=0;i=i-2){  
  48.         res+=((-C[i])*p[i]+C[i-1]*p[i-1])%M;  
  49.     }  
  50.     if(res%M<0) printf("%lld\n",(res%M)+M);  
  51.     else printf("%lld\n",res%M);  
  52.     return 0;  
  53. }  

'; print "


4. Explosion (by k5888200)
"; print'
  1. #include <stdio.h>  
  2.   
  3. int n,N=1;  
  4.   
  5. struct Queue{  
  6.     int a[21][21],cnt;  
  7. }queue[100000];  
  8.   
  9. int check(int x){  
  10.     int i,j;  
  11.     for(i=1;i<n;i++)  
  12.         for(j=1;j<=n;j++)  
  13.             if(queue[x].a[i][j]==1 && queue[x].a[i+1][j]==0)  
  14.                 return 0;  
  15.     return 1;  
  16. }  
  17. void R(int x){  
  18.     int i,j;  
  19.     N++;  
  20.     for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[j][n-i+1]=queue[x].a[i][j];  
  21.     queue[N].cnt=queue[x].cnt+1;  
  22. }  
  23. void L(int x){  
  24.     int i,j;  
  25.     N++;  
  26.     for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[i][j]=queue[x].a[j][n-i+1];  
  27.     queue[N].cnt=queue[x].cnt+1;  
  28. }  
  29. void D(int x){  
  30.     int i,j;  
  31.     queue[++N]=queue[x]; queue[N].cnt++;  
  32.     for(i=n-1;i>=1;i--) for(j=1;j<=n;j++) if(queue[N].a[i][j]==1 && queue[N].a[i+1][j]==0) queue[N].a[i][j]=0, queue[N].a[i+1][j]=1;  
  33. }  
  34. void print(int x){  
  35.     int i,j;  
  36.     for(i=1;i<=n;i++){  
  37.         for(j=1;j<=n;j++) printf("%d",queue[x].a[i][j]);  
  38.         printf("\n");  
  39.     }  
  40.     printf("\n");  
  41. }  
  42.   
  43. int main(){  
  44.   
  45.     int i,j;  
  46.   
  47.     scanf("%d",&n);  
  48.     for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%1d",&queue[1].a[i][j]);  
  49.   
  50.     for(i=1;i<=N;i++){  
  51.         D(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}  
  52.         R(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}  
  53.         L(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}  
  54.     }  
  55. }  

'; print "


5. Bingo Card

- There is not a perfact Solution!! Try solve!! -"; print "
�� �ع��� �м��Ͽ� ������ �����սô�. ���� ��ϵǸ� �����ϼ���!!"; print ''; ?>