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


"; print "6ȸ ���� �ڴ���!! ���

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

"; print " : dijkstra, gs11018, wdyd2004
"; print " : dijkstra, gs11018, wdyd2004, zlzmsrhak56
"; print " : gs12065, gs12059, wclee2265, gs11028, tncks0121, ainta, gs10102, pl0892029
"; print " : gs11059, gs10107, gs11103, k5888200, gs11008, makesource, lawl, gs11043, commaster0, gs11048, august14, gs12011

"; $dir="/var/www/bbs/moi/6thchk/"; $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 += 16+($j*0.001); else if($j==2) $score += 18+($j*0.001); else if($j==3) $score += 20+($j*0.001); else if($j==4) $score += 15.71+($j*0.001); else if($j==5) $score += 17.14+($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 Dual Number(160) Call Taxi(180) Max Sum(200) Zero Path(220) Light Mobil(240) 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 perfect Solution!!


1. Dual Number (by Dijkstra)"; print '
  1. #include <stdio.h>  
  2. #include <math.h>  
  3.   
  4. main(){  
  5.     long long n,t=5;  
  6.     while(t--)  
  7.     {  
  8.         scanf("%lld",&n);  
  9.         if(n==(n*n)%(int)powf(10,(int)log10(n)+1)) printf("YES\n");  
  10.         else printf("NO\n");  
  11.     }     
  12. }  

'; print 'Here is another solution (by wdyd2004)
  1. #include <stdio.h>  
  2. #include <string.h>  
  3. long long n;  
  4. int q=5,i,j;  
  5. int main(){  
  6.     while(q--){  
  7.         scanf("%lld",&n);  
  8.         char a[50]={0,},b[50]={0,};  
  9.         sprintf(a,"%lld",n);  
  10.         sprintf(b,"%lld",n*n);  
  11.         int A=strlen(a),B=strlen(b);  
  12.         for(i=A-1,j=B-1;i>=0&&a[i]==b[j];i--,j--);  
  13.         if(i<0) puts("YES");  
  14.         else puts("NO");  
  15.     }  
  16.     return 0;  
  17. }  

'; print "


2. Call Taxi (by gs11018)"; print '
  1. #include<stdio.h>  
  2. int abs (int n) {  
  3.     if (n<0) return -n;  
  4.     else return n;  
  5. }  
  6. int main () {  
  7.     int i,j;  
  8.     int x1,x2,y1,y2,d1,d2;  
  9.     int ans=0;  
  10.     scanf("%d %d %d %d %d %d",&x1,&y1,&d1,&x2,&y2,&d2);  
  11.     if (d1>d2) {   
  12.         for(i=x2-d2;i<=x2+d2;i++) {  
  13.             int temp=d2-abs(x2-i);  
  14.             j=y2-temp;  
  15.             if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;  
  16.             if (temp!=0) {  
  17.                 j=y2+temp;  
  18.                 if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;  
  19.             }  
  20.         }  
  21.     }  
  22.     else {  
  23.         for(i=x1-d1;i<=x1+d1;i++) {  
  24.             int temp=d1-abs(x1-i);  
  25.             j=y1-temp;  
  26.             if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;  
  27.             if (temp!=0) {  
  28.                 j=y1+temp;  
  29.                 if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;  
  30.             }  
  31.         }  
  32.     }  
  33.     printf("%d",ans);  
  34.     return 0;  
  35. }  

'; print 'Here is another solution (by pl0892029)
  1. #include <stdio.h>  
  2.   
  3. int abs(int x){return x<0 ? -x:x;}  
  4.   
  5. int main()  
  6. {  
  7.     int i,cnt=0, last;  
  8.     int x1,y1,d1;  
  9.     int x2,y2,d2;  
  10.     scanf("%d %d %d",&x1,&y1,&d1);  
  11.     scanf("%d %d %d",&x2,&y2,&d2);  
  12.     last = x2+d2 > 100000000 ? 100000000 : x2+d2;  
  13.       
  14.     i = x2<d2? 0:x2-d2;  
  15.     if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;  
  16.   
  17.     for(++i;i<last;i++)   
  18.     {  
  19.         if( abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1 ) cnt++;  
  20.         if( abs(x1 -i) + abs(y1-(y2-abs(i-x2)+d2)) == d1 ) cnt++;  
  21.     }  
  22.   
  23.     if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;  
  24.   
  25.     printf("%d",cnt);  
  26. }  

'; print "


3. Max Sum (by zlzmsrhak56)"; print '
  1. #include<stdio.h>  
  2. int d[100005];  
  3. int main()  
  4. {  
  5.     int n,k,ans=0,max=0x80000000,i;  
  6.     scanf("%d%d",&n,&k);  
  7.     for(i=0;i<k;i++){  
  8.         scanf("%d",d+i);  
  9.         ans+=d[i];  
  10.     }  
  11.     if(max<ans)max=ans;  
  12.     for(;i<n;i++){  
  13.         scanf("%d",d+i);  
  14.         ans+=d[i];  
  15.         ans-=d[i-k];  
  16.         if(max<ans)max=ans;  
  17.     }  
  18.     printf("%d",max);  
  19. }  

'; print "


4. Zero Path (by wclee2265)"; print '
  1. #include <stdio.h>  
  2. #include <memory.h>  
  3.   
  4. #define N 1005  
  5. #define INF 1000000000  
  6. #define Min(x,y) ((x)<(y)?(x):(y))  
  7.   
  8. FILE *in=stdin;  
  9. FILE *out=stdout;  
  10.   
  11. int n,a[N][N],b[2][N][N],ans,dy[N][N];  
  12.   
  13. int get_shortest(int b[][N])  
  14. {  
  15.     int i,j;  
  16.     for(i=0;i<=n;i++) dy[0][i]=dy[i][0]=INF;  
  17.     dy[1][0]=dy[0][1]=0;  
  18.     for(i=1;i<=n;i++){  
  19.         for(j=1;j<=n;j++){  
  20.             if(a[i][j]==0) dy[i][j]=INF;  
  21.             else dy[i][j]=Min(dy[i-1][j],dy[i][j-1])+b[i][j];  
  22.         }  
  23.     }  
  24.     return dy[n][n];  
  25. }  
  26.   
  27. void process()  
  28. {  
  29.     int tmp1, tmp2;  
  30.     tmp1=get_shortest(b[0]);  
  31.     tmp2=get_shortest(b[1]);  
  32.   
  33.     ans=Min(tmp1,tmp2);  
  34. }  
  35.   
  36. int get_insu(int t, int insu)  
  37. {  
  38.     int cnt=0;  
  39.     while(t!=0 && t%insu==0){  
  40.         cnt++;  
  41.         t/=insu;  
  42.     }  
  43.     return cnt;  
  44. }  
  45.   
  46. int main()  
  47. {  
  48.     int i,j;  
  49.     fscanf(in,"%d",&n);  
  50.     for(i=1;i<=n;i++){  
  51.         for(j=1;j<=n;j++){  
  52.             fscanf(in,"%d",&a[i][j]);  
  53.             b[0][i][j]=get_insu(a[i][j],2);  
  54.             b[1][i][j]=get_insu(a[i][j],5);  
  55.         }  
  56.     }  
  57.     process();  
  58.     fprintf(out,"%d",ans);  
  59.     fclose(in);  
  60.     fclose(out);  
  61.     return 0;  
  62. }  

'; print 'Here is another solution (by ainta)
  1. #include<stdio.h>  
  2. int min(int a,int b){if(a<b)return a;return b;}  
  3. int n,w[1001][1001],D[2][1001][1001],i,j,r[2][1001][1001],a;  
  4. int main(){  
  5.     scanf("%d",&n);  
  6.     for(i=1;i<=n;i++){  
  7.         for(j=1;j<=n;j++){  
  8.             scanf("%d",&w[i][j]);a=w[i][j];  
  9.             while(a>0&&!(a&1))a/=2,r[0][i][j]++;  
  10.             while(a>0&&a%5==0)a/=5,r[1][i][j]++;  
  11.             D[0][i][j]=D[1][i][j]=1e9;  
  12.         }  
  13.     }  
  14.     for(i=1;i<=n;i++){  
  15.         for(j=1;j<=n;j++){  
  16.             if(i==1&&j==1){D[0][1][1]=r[0][1][1],D[1][1][1]=r[1][1][1];continue;}  
  17.             if(w[i][j]==0)continue;  
  18.             if(i>1)D[0][i][j]=D[0][i-1][j]+r[0][i][j],D[1][i][j]=D[1][i-1][j]+r[1][i][j];  
  19.             if(j>1&&D[0][i][j]>D[0][i][j-1]+r[0][i][j])D[0][i][j]=D[0][i][j-1]+r[0][i][j];  
  20.             if(j>1&&D[1][i][j]>D[1][i][j-1]+r[1][i][j])D[1][i][j]=D[1][i][j-1]+r[1][i][j];  
  21.         }  
  22.     }  
  23.     printf("%d\n",min(D[0][n][n],D[1][n][n]));  
  24. }  

'; print "


5. Light Mobil (by gs12065)"; print '
  1. #include <stdio.h>  
  2.   
  3. struct stick{  
  4.     long long weight, lLen, rLen;  
  5.     int l, r;  
  6. } st[105];  
  7.   
  8. int n, cnt[105];  
  9.   
  10. int gcd(long long a, long long b){  
  11.     if(b == 0) return a;  
  12.     else return gcd(b, a%b);  
  13. }  
  14.   
  15. void calc(int num){  
  16.     if(num == 0) return;  
  17.     stick &now=st[num];  
  18.     int g=gcd(now.lLen, now.rLen), a, b;  
  19.     now.lLen /= g;  
  20.     now.rLen /= g;  
  21.     calc(now.l);  
  22.     calc(now.r);  
  23.     a = st[now.l].weight/gcd(st[now.l].weight, now.rLen)*now.rLen;  
  24.     b = st[now.r].weight/gcd(st[now.r].weight, now.lLen)*now.lLen;  
  25.     g = (a/now.rLen)/gcd(a/now.rLen, b/now.lLen)*(b/now.lLen);  
  26.     now.weight = g*(now.lLen+now.rLen);  
  27. }  
  28.   
  29. int main(){  
  30.     scanf("%d", &n);  
  31.   
  32.     int i, g;  
  33.     for(i=1; i<=n; i++){  
  34.         scanf("%lld%lld%d%d", &st[i].lLen, &st[i].rLen, &st[i].l, &st[i].r);  
  35.         if(st[i].l != 0) cnt[st[i].l]++;  
  36.         if(st[i].r != 0) cnt[st[i].r]++;;  
  37.     }  
  38.   
  39.     for(i=1; i<=n; i++) if(cnt[i] == 0) break;  
  40.     st[0].weight = 1;  
  41.     calc(i);  
  42.     printf("%lld\n", st[i].weight);  
  43.   
  44.     return 0;  
  45. }  

'; print 'Here is another solution (by tncks0121)
  1. #include<stdio.h>  
  2.   
  3. #define N_ 101  
  4. int N;  
  5. struct mobil{  
  6.     int p,p_n;  
  7.     int q,q_n;  
  8.     mobil(){}  
  9.     mobil(int p,int q,int p_n,int q_n){  
  10.         this->p = p; this->q = q;  
  11.         this->p_n = p_n; this->q_n = q_n;  
  12.     }  
  13. }D[N_];  
  14. bool Chk[N_+1];  
  15. int root_mobil;  
  16.   
  17. int gcd(int a,int b){  
  18.     for(;b;){ int c=a%b; a=b; b=c; }  
  19.     return a;  
  20. }  
  21.   
  22. int result(int stick){  
  23.     int i;  
  24.   
  25.     if(stick == 0) return 1;  
  26.     int left_weight = result(D[stick].p_n);  
  27.     int right_weight = result(D[stick].q_n);  
  28.   
  29.     int a = (right_weight * D[stick].q);  
  30.     int b = (left_weight * D[stick].p);  
  31.     int t = gcd(a,b);  
  32.     a /= t; b /= t;  
  33.   
  34.     return left_weight * a + right_weight * b;  
  35.   
  36.     // a = (right_weight * D[stick].q) / (left_weight * D[stick].p) * b  
  37.     // a = (right_weight * D[stick].q) / GCD  
  38.     // b = (left_weight * D[stick].p)  / GCD  
  39. }  
  40.   
  41. int main(){  
  42.     int i;  
  43.   
  44.     scanf("%d",&N);  
  45.     for(i=1;i<=N;i++){  
  46.         int a,b,c,d;  
  47.         scanf("%d%d%d%d",&a,&b,&c,&d);  
  48.         int t = gcd(a,b);  
  49.         a/=t; b/=t;  
  50.         D[i] = mobil(a,b,c,d);  
  51.         Chk[c] = Chk[d] = true;  
  52.     }  
  53.     for(root_mobil=1;root_mobil<=N;root_mobil++){  
  54.         if(!Chk[root_mobil]) break;  
  55.     }  
  56.     printf("%d\n",result(root_mobil));  
  57.     return 0;  
  58. }  

'; print "
�� �ع��� �м��Ͽ� ������ �����սô�. ���� ��ϵǸ� �����ϼ���!!"; print ''; ?>