";
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 '- #include <stdio.h>
- #include <math.h>
-
- main(){
- long long n,t=5;
- while(t--)
- {
- scanf("%lld",&n);
- if(n==(n*n)%(int)powf(10,(int)log10(n)+1)) printf("YES\n");
- else printf("NO\n");
- }
- }
#include <stdio.h>
#include <math.h>
main(){
long long n,t=5;
while(t--)
{
scanf("%lld",&n);
if(n==(n*n)%(int)powf(10,(int)log10(n)+1)) printf("YES\n");
else printf("NO\n");
}
}
';
print 'Here is another solution (by wdyd2004)
- #include <stdio.h>
- #include <string.h>
- long long n;
- int q=5,i,j;
- int main(){
- while(q--){
- scanf("%lld",&n);
- char a[50]={0,},b[50]={0,};
- sprintf(a,"%lld",n);
- sprintf(b,"%lld",n*n);
- int A=strlen(a),B=strlen(b);
- for(i=A-1,j=B-1;i>=0&&a[i]==b[j];i--,j--);
- if(i<0) puts("YES");
- else puts("NO");
- }
- return 0;
- }
#include <stdio.h>
#include <string.h>
long long n;
int q=5,i,j;
int main(){
while(q--){
scanf("%lld",&n);
char a[50]={0,},b[50]={0,};
sprintf(a,"%lld",n);
sprintf(b,"%lld",n*n);
int A=strlen(a),B=strlen(b);
for(i=A-1,j=B-1;i>=0&&a[i]==b[j];i--,j--);
if(i<0) puts("YES");
else puts("NO");
}
return 0;
}
';
print "
2. Call Taxi (by gs11018)";
print '- #include<stdio.h>
- int abs (int n) {
- if (n<0) return -n;
- else return n;
- }
- int main () {
- int i,j;
- int x1,x2,y1,y2,d1,d2;
- int ans=0;
- scanf("%d %d %d %d %d %d",&x1,&y1,&d1,&x2,&y2,&d2);
- if (d1>d2) {
- for(i=x2-d2;i<=x2+d2;i++) {
- int temp=d2-abs(x2-i);
- j=y2-temp;
- if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;
- if (temp!=0) {
- j=y2+temp;
- if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;
- }
- }
- }
- else {
- for(i=x1-d1;i<=x1+d1;i++) {
- int temp=d1-abs(x1-i);
- j=y1-temp;
- if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;
- if (temp!=0) {
- j=y1+temp;
- if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;
- }
- }
- }
- printf("%d",ans);
- return 0;
- }
#include<stdio.h>
int abs (int n) {
if (n<0) return -n;
else return n;
}
int main () {
int i,j;
int x1,x2,y1,y2,d1,d2;
int ans=0;
scanf("%d %d %d %d %d %d",&x1,&y1,&d1,&x2,&y2,&d2);
if (d1>d2) {
for(i=x2-d2;i<=x2+d2;i++) {
int temp=d2-abs(x2-i);
j=y2-temp;
if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;
if (temp!=0) {
j=y2+temp;
if(i>=0 && j>=0 && abs(x1-i)+abs(y1-j)==d1) ans++;
}
}
}
else {
for(i=x1-d1;i<=x1+d1;i++) {
int temp=d1-abs(x1-i);
j=y1-temp;
if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;
if (temp!=0) {
j=y1+temp;
if(i>=0 && j>=0 && abs(x2-i)+abs(y2-j)==d2) ans++;
}
}
}
printf("%d",ans);
return 0;
}
';
print 'Here is another solution (by pl0892029)
- #include <stdio.h>
-
- int abs(int x){return x<0 ? -x:x;}
-
- int main()
- {
- int i,cnt=0, last;
- int x1,y1,d1;
- int x2,y2,d2;
- scanf("%d %d %d",&x1,&y1,&d1);
- scanf("%d %d %d",&x2,&y2,&d2);
- last = x2+d2 > 100000000 ? 100000000 : x2+d2;
-
- i = x2<d2? 0:x2-d2;
- if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;
-
- for(++i;i<last;i++)
- {
- if( abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1 ) cnt++;
- if( abs(x1 -i) + abs(y1-(y2-abs(i-x2)+d2)) == d1 ) cnt++;
- }
-
- if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;
-
- printf("%d",cnt);
- }
#include <stdio.h>
int abs(int x){return x<0 ? -x:x;}
int main()
{
int i,cnt=0, last;
int x1,y1,d1;
int x2,y2,d2;
scanf("%d %d %d",&x1,&y1,&d1);
scanf("%d %d %d",&x2,&y2,&d2);
last = x2+d2 > 100000000 ? 100000000 : x2+d2;
i = x2<d2? 0:x2-d2;
if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;
for(++i;i<last;i++)
{
if( abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1 ) cnt++;
if( abs(x1 -i) + abs(y1-(y2-abs(i-x2)+d2)) == d1 ) cnt++;
}
if(abs(x1 -i) + abs(y1-(y2+abs(i-x2)-d2)) == d1) cnt++;
printf("%d",cnt);
}
';
print "
3. Max Sum (by zlzmsrhak56)";
print '- #include<stdio.h>
- int d[100005];
- int main()
- {
- int n,k,ans=0,max=0x80000000,i;
- scanf("%d%d",&n,&k);
- for(i=0;i<k;i++){
- scanf("%d",d+i);
- ans+=d[i];
- }
- if(max<ans)max=ans;
- for(;i<n;i++){
- scanf("%d",d+i);
- ans+=d[i];
- ans-=d[i-k];
- if(max<ans)max=ans;
- }
- printf("%d",max);
- }
#include<stdio.h>
int d[100005];
int main()
{
int n,k,ans=0,max=0x80000000,i;
scanf("%d%d",&n,&k);
for(i=0;i<k;i++){
scanf("%d",d+i);
ans+=d[i];
}
if(max<ans)max=ans;
for(;i<n;i++){
scanf("%d",d+i);
ans+=d[i];
ans-=d[i-k];
if(max<ans)max=ans;
}
printf("%d",max);
}
';
print "
4. Zero Path (by wclee2265)";
print '- #include <stdio.h>
- #include <memory.h>
-
- #define N 1005
- #define INF 1000000000
- #define Min(x,y) ((x)<(y)?(x):(y))
-
- FILE *in=stdin;
- FILE *out=stdout;
-
- int n,a[N][N],b[2][N][N],ans,dy[N][N];
-
- int get_shortest(int b[][N])
- {
- int i,j;
- for(i=0;i<=n;i++) dy[0][i]=dy[i][0]=INF;
- dy[1][0]=dy[0][1]=0;
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++){
- if(a[i][j]==0) dy[i][j]=INF;
- else dy[i][j]=Min(dy[i-1][j],dy[i][j-1])+b[i][j];
- }
- }
- return dy[n][n];
- }
-
- void process()
- {
- int tmp1, tmp2;
- tmp1=get_shortest(b[0]);
- tmp2=get_shortest(b[1]);
-
- ans=Min(tmp1,tmp2);
- }
-
- int get_insu(int t, int insu)
- {
- int cnt=0;
- while(t!=0 && t%insu==0){
- cnt++;
- t/=insu;
- }
- return cnt;
- }
-
- int main()
- {
- int i,j;
- fscanf(in,"%d",&n);
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++){
- fscanf(in,"%d",&a[i][j]);
- b[0][i][j]=get_insu(a[i][j],2);
- b[1][i][j]=get_insu(a[i][j],5);
- }
- }
- process();
- fprintf(out,"%d",ans);
- fclose(in);
- fclose(out);
- return 0;
- }
#include <stdio.h>
#include <memory.h>
#define N 1005
#define INF 1000000000
#define Min(x,y) ((x)<(y)?(x):(y))
FILE *in=stdin;
FILE *out=stdout;
int n,a[N][N],b[2][N][N],ans,dy[N][N];
int get_shortest(int b[][N])
{
int i,j;
for(i=0;i<=n;i++) dy[0][i]=dy[i][0]=INF;
dy[1][0]=dy[0][1]=0;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(a[i][j]==0) dy[i][j]=INF;
else dy[i][j]=Min(dy[i-1][j],dy[i][j-1])+b[i][j];
}
}
return dy[n][n];
}
void process()
{
int tmp1, tmp2;
tmp1=get_shortest(b[0]);
tmp2=get_shortest(b[1]);
ans=Min(tmp1,tmp2);
}
int get_insu(int t, int insu)
{
int cnt=0;
while(t!=0 && t%insu==0){
cnt++;
t/=insu;
}
return cnt;
}
int main()
{
int i,j;
fscanf(in,"%d",&n);
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
fscanf(in,"%d",&a[i][j]);
b[0][i][j]=get_insu(a[i][j],2);
b[1][i][j]=get_insu(a[i][j],5);
}
}
process();
fprintf(out,"%d",ans);
fclose(in);
fclose(out);
return 0;
}
';
print 'Here is another solution (by ainta)
- #include<stdio.h>
- int min(int a,int b){if(a<b)return a;return b;}
- int n,w[1001][1001],D[2][1001][1001],i,j,r[2][1001][1001],a;
- int main(){
- scanf("%d",&n);
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++){
- scanf("%d",&w[i][j]);a=w[i][j];
- while(a>0&&!(a&1))a/=2,r[0][i][j]++;
- while(a>0&&a%5==0)a/=5,r[1][i][j]++;
- D[0][i][j]=D[1][i][j]=1e9;
- }
- }
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++){
- if(i==1&&j==1){D[0][1][1]=r[0][1][1],D[1][1][1]=r[1][1][1];continue;}
- if(w[i][j]==0)continue;
- 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];
- 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];
- 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];
- }
- }
- printf("%d\n",min(D[0][n][n],D[1][n][n]));
- }
#include<stdio.h>
int min(int a,int b){if(a<b)return a;return b;}
int n,w[1001][1001],D[2][1001][1001],i,j,r[2][1001][1001],a;
int main(){
scanf("%d",&n);
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
scanf("%d",&w[i][j]);a=w[i][j];
while(a>0&&!(a&1))a/=2,r[0][i][j]++;
while(a>0&&a%5==0)a/=5,r[1][i][j]++;
D[0][i][j]=D[1][i][j]=1e9;
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(i==1&&j==1){D[0][1][1]=r[0][1][1],D[1][1][1]=r[1][1][1];continue;}
if(w[i][j]==0)continue;
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];
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];
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];
}
}
printf("%d\n",min(D[0][n][n],D[1][n][n]));
}
';
print "
5. Light Mobil (by gs12065)";
print '- #include <stdio.h>
-
- struct stick{
- long long weight, lLen, rLen;
- int l, r;
- } st[105];
-
- int n, cnt[105];
-
- int gcd(long long a, long long b){
- if(b == 0) return a;
- else return gcd(b, a%b);
- }
-
- void calc(int num){
- if(num == 0) return;
- stick &now=st[num];
- int g=gcd(now.lLen, now.rLen), a, b;
- now.lLen /= g;
- now.rLen /= g;
- calc(now.l);
- calc(now.r);
- a = st[now.l].weight/gcd(st[now.l].weight, now.rLen)*now.rLen;
- b = st[now.r].weight/gcd(st[now.r].weight, now.lLen)*now.lLen;
- g = (a/now.rLen)/gcd(a/now.rLen, b/now.lLen)*(b/now.lLen);
- now.weight = g*(now.lLen+now.rLen);
- }
-
- int main(){
- scanf("%d", &n);
-
- int i, g;
- for(i=1; i<=n; i++){
- scanf("%lld%lld%d%d", &st[i].lLen, &st[i].rLen, &st[i].l, &st[i].r);
- if(st[i].l != 0) cnt[st[i].l]++;
- if(st[i].r != 0) cnt[st[i].r]++;;
- }
-
- for(i=1; i<=n; i++) if(cnt[i] == 0) break;
- st[0].weight = 1;
- calc(i);
- printf("%lld\n", st[i].weight);
-
- return 0;
- }
#include <stdio.h>
struct stick{
long long weight, lLen, rLen;
int l, r;
} st[105];
int n, cnt[105];
int gcd(long long a, long long b){
if(b == 0) return a;
else return gcd(b, a%b);
}
void calc(int num){
if(num == 0) return;
stick &now=st[num];
int g=gcd(now.lLen, now.rLen), a, b;
now.lLen /= g;
now.rLen /= g;
calc(now.l);
calc(now.r);
a = st[now.l].weight/gcd(st[now.l].weight, now.rLen)*now.rLen;
b = st[now.r].weight/gcd(st[now.r].weight, now.lLen)*now.lLen;
g = (a/now.rLen)/gcd(a/now.rLen, b/now.lLen)*(b/now.lLen);
now.weight = g*(now.lLen+now.rLen);
}
int main(){
scanf("%d", &n);
int i, g;
for(i=1; i<=n; i++){
scanf("%lld%lld%d%d", &st[i].lLen, &st[i].rLen, &st[i].l, &st[i].r);
if(st[i].l != 0) cnt[st[i].l]++;
if(st[i].r != 0) cnt[st[i].r]++;;
}
for(i=1; i<=n; i++) if(cnt[i] == 0) break;
st[0].weight = 1;
calc(i);
printf("%lld\n", st[i].weight);
return 0;
}
';
print 'Here is another solution (by tncks0121)
- #include<stdio.h>
-
- #define N_ 101
- int N;
- struct mobil{
- int p,p_n;
- int q,q_n;
- mobil(){}
- mobil(int p,int q,int p_n,int q_n){
- this->p = p; this->q = q;
- this->p_n = p_n; this->q_n = q_n;
- }
- }D[N_];
- bool Chk[N_+1];
- int root_mobil;
-
- int gcd(int a,int b){
- for(;b;){ int c=a%b; a=b; b=c; }
- return a;
- }
-
- int result(int stick){
- int i;
-
- if(stick == 0) return 1;
- int left_weight = result(D[stick].p_n);
- int right_weight = result(D[stick].q_n);
-
- int a = (right_weight * D[stick].q);
- int b = (left_weight * D[stick].p);
- int t = gcd(a,b);
- a /= t; b /= t;
-
- return left_weight * a + right_weight * b;
-
-
-
-
- }
-
- int main(){
- int i;
-
- scanf("%d",&N);
- for(i=1;i<=N;i++){
- int a,b,c,d;
- scanf("%d%d%d%d",&a,&b,&c,&d);
- int t = gcd(a,b);
- a/=t; b/=t;
- D[i] = mobil(a,b,c,d);
- Chk[c] = Chk[d] = true;
- }
- for(root_mobil=1;root_mobil<=N;root_mobil++){
- if(!Chk[root_mobil]) break;
- }
- printf("%d\n",result(root_mobil));
- return 0;
- }
#include<stdio.h>
#define N_ 101
int N;
struct mobil{
int p,p_n;
int q,q_n;
mobil(){}
mobil(int p,int q,int p_n,int q_n){
this->p = p; this->q = q;
this->p_n = p_n; this->q_n = q_n;
}
}D[N_];
bool Chk[N_+1];
int root_mobil;
int gcd(int a,int b){
for(;b;){ int c=a%b; a=b; b=c; }
return a;
}
int result(int stick){
int i;
if(stick == 0) return 1;
int left_weight = result(D[stick].p_n);
int right_weight = result(D[stick].q_n);
int a = (right_weight * D[stick].q);
int b = (left_weight * D[stick].p);
int t = gcd(a,b);
a /= t; b /= t;
return left_weight * a + right_weight * b;
// a = (right_weight * D[stick].q) / (left_weight * D[stick].p) * b
// a = (right_weight * D[stick].q) / GCD
// b = (left_weight * D[stick].p) / GCD
}
int main(){
int i;
scanf("%d",&N);
for(i=1;i<=N;i++){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
int t = gcd(a,b);
a/=t; b/=t;
D[i] = mobil(a,b,c,d);
Chk[c] = Chk[d] = true;
}
for(root_mobil=1;root_mobil<=N;root_mobil++){
if(!Chk[root_mobil]) break;
}
printf("%d\n",result(root_mobil));
return 0;
}
';
print "
�� �ع��� �м��Ͽ� ������ �����սô�. ���� ��ϵǸ� �����ϼ���!!";
print '';
?>