";
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 '- #include <stdio.h>
-
- int n, m, k, t, now;
- long long sum, mul=1;
- bool dir;
-
- int main(){
- scanf("%d%d%d", &n, &m, &k);
-
- int i;
- for(i=0; i<m; i++){
- scanf("%d", &t);
- now+=dir?-1:1;
- if(now == 0) now = n;
- if(now > n) now = 1;
-
- if(t == 10001) dir = !dir;
- else if(t == 10002) mul *= 2;
- else{
- sum += t*mul;
- if(sum%11 == 0 || sum >= k) break;
- mul = 1;
- }
- }
-
- if(i == m) printf("0\n");
- else printf("%d\n", now);
-
- return 0;
- }
#include <stdio.h>
int n, m, k, t, now;
long long sum, mul=1;
bool dir;
int main(){
scanf("%d%d%d", &n, &m, &k);
int i;
for(i=0; i<m; i++){
scanf("%d", &t);
now+=dir?-1:1;
if(now == 0) now = n;
if(now > n) now = 1;
if(t == 10001) dir = !dir;
else if(t == 10002) mul *= 2;
else{
sum += t*mul;
if(sum%11 == 0 || sum >= k) break;
mul = 1;
}
}
if(i == m) printf("0\n");
else printf("%d\n", now);
return 0;
}
';
print "
2. Postfix Equation (by gs11008) ";
print '- #include<stdio.h>
- #include<stack>
- using namespace std;
- int a[2000030],index,dap;
- char s[4000005];
-
- int calc(int a,int b,int c){
- if(b==-2)return a+c;
- if(b==-3)return a-c;
- if(b==-4)return a*c;
- return a/c;
- }
-
-
- int huwhi(int p,int q){
- int i;
- stack<int> S;
- for(i=p;i<=q;i++){
- if(a[i]>=0)
- S.push(a[i]);
- else{
- int x,y;
- y=S.top();
- S.pop();
- x=S.top();
- S.pop();
- S.push(calc(x,a[i],y));
- }
- }
- return S.top();
- }
- int f(int p,int q){
- int chk=0,flag=0,i;
- for(i=q-1;i>=p&&chk!=1;i--){
- if(a[i]==-1)flag=1;
- if(a[i]>=-1)chk++;
- else chk--;
- }
- if(a[q]==-2){
- if(flag==0){
- dap-=huwhi(i+1,q-1);
- f(p,i);
- }
- else{
- dap-=huwhi(p,i);
- f(i+1,q-1);
- }
- }
- else if(a[q]==-3){
- if(flag==0){
- dap+=huwhi(i+1,q-1);
- f(p,i);
- }
- else{
- dap=huwhi(p,i)-dap;
- f(i+1,q-1);
- }
- }
- else if(a[q]==-4){
- if(flag==0){
- dap/=huwhi(i+1,q-1);
- f(p,i);
- }
- else{
- dap/=huwhi(p,i);
- f(i+1,q-1);
- }
- }
- else if(a[q]==-5){
- if(flag==0){
- dap*=huwhi(i+1,q-1);
- f(p,i);
- }
- else{
- dap=huwhi(p,i)/dap;
- f(i+1,q-1);
- }
- }
- return 0;
- }
-
- int main(){
- int i;
- for(;scanf("%s",s);){
- if(s[0]=='x'){
- a[index++]=-1;
- continue;
- }
- else if(s[0]=='+'){
- a[index++]=-2;
- continue;
- }
- else if(s[0]=='-'){
- a[index++]=-3;
- continue;
- }
- else if(s[0]=='*'){
- a[index++]=-4;
- continue;
- }
- else if(s[0]=='/'){
- a[index++]=-5;
- continue;
- }
- else if(s[0]=='=')break;
- int d=0;
- i=0;
- while(1){
- if(s[i]=='\0')break;
- d*=10;
- d+=s[i]-'0';
- i++;
- }
- a[index++]=d;
- }
- int d=0;
- scanf("%d",&dap);
- f(0,index-1);
- printf("%d",dap);
- }
#include<stdio.h>
#include<stack>
using namespace std;
int a[2000030],index,dap;
char s[4000005];
// Last case is TLE
int calc(int a,int b,int c){
if(b==-2)return a+c;
if(b==-3)return a-c;
if(b==-4)return a*c;
return a/c;
}
int huwhi(int p,int q){
int i;
stack<int> S;
for(i=p;i<=q;i++){
if(a[i]>=0)
S.push(a[i]);
else{
int x,y;
y=S.top();
S.pop();
x=S.top();
S.pop();
S.push(calc(x,a[i],y));
}
}
return S.top();
}
int f(int p,int q){
int chk=0,flag=0,i;
for(i=q-1;i>=p&&chk!=1;i--){
if(a[i]==-1)flag=1;
if(a[i]>=-1)chk++;
else chk--;
}
if(a[q]==-2){
if(flag==0){
dap-=huwhi(i+1,q-1);
f(p,i);
}
else{
dap-=huwhi(p,i);
f(i+1,q-1);
}
}
else if(a[q]==-3){
if(flag==0){
dap+=huwhi(i+1,q-1);
f(p,i);
}
else{
dap=huwhi(p,i)-dap;
f(i+1,q-1);
}
}
else if(a[q]==-4){
if(flag==0){
dap/=huwhi(i+1,q-1);
f(p,i);
}
else{
dap/=huwhi(p,i);
f(i+1,q-1);
}
}
else if(a[q]==-5){
if(flag==0){
dap*=huwhi(i+1,q-1);
f(p,i);
}
else{
dap=huwhi(p,i)/dap;
f(i+1,q-1);
}
}
return 0;
}
int main(){
int i;
for(;scanf("%s",s);){
if(s[0]=='x'){
a[index++]=-1;
continue;
}
else if(s[0]=='+'){
a[index++]=-2;
continue;
}
else if(s[0]=='-'){
a[index++]=-3;
continue;
}
else if(s[0]=='*'){
a[index++]=-4;
continue;
}
else if(s[0]=='/'){
a[index++]=-5;
continue;
}
else if(s[0]=='=')break;
int d=0;
i=0;
while(1){
if(s[i]=='\0')break;
d*=10;
d+=s[i]-'0';
i++;
}
a[index++]=d;
}
int d=0;
scanf("%d",&dap);
f(0,index-1);
printf("%d",dap);
}
';
print "
Here is another solution (by gs12065)
";
print '
- #include <stdio.h>
- #include <stack>
-
- struct number {
- long long s, sx;
- long long m, mx;
- } tp, f, s;
-
- char c[30];
- int res;
- long long g;
- std::stack < number > st;
-
- long long gcd(long long a, long long b){
- long long t;
- while(b>0){
- t = b;
- b = a%b;
- a = t;
- }
- return a;
- }
-
- int main(){
- int i, t;
- while(scanf("%s", c)){
- if(c[0] == 'x'){
- tp.s = 0;
- tp.sx = 1;
- tp.m = 1;
- tp.mx = 0;
- st.push(tp);
- } else if(c[0] == '=') {
- scanf("%d", &res);
- tp = st.top();
- break;
- } else if(c[0] >= '0' && c[0] <= '9') {
- t = c[0]-'0';
- for(i=1; c[i]!=0; i++){
- t *= 10;
- t += c[i]-'0';
- }
- tp.s = t;
- tp.sx = 0;
- tp.m = 1;
- tp.mx = 0;
- st.push(tp);
- } else {
- s = st.top();
- st.pop();
- f = st.top();
- st.pop();
- if(c[0] == '-' || c[0] == '+'){
- if(f.mx){
- g = s.m/gcd(gcd(f.m, f.mx), s.m);
- f.m *= g;
- f.mx *= g;
- f.s *= g;
- f.sx *= g;
- s.sx = s.s*f.mx/s.m;
- s.s = s.s*f.m/s.m;
- } else if(s.mx){
- g = f.m/gcd(gcd(s.m, s.mx), f.m);
- s.m *= g;
- s.mx *= g;
- s.s *= g;
- s.sx *= g;
- f.sx = f.s*s.mx/f.m;
- f.s = f.s*s.m/f.m;
- } else {
- g = f.m*s.m/gcd(f.m, s.m);
- f.s *= g/f.m;
- f.sx *= g/f.m;
- s.s *= g/s.m;
- s.sx *= g/s.m;
- f.m = s.m = g;
- }
- tp.m = f.m;
- tp.mx = f.mx;
- if(c[0] == '-'){
- tp.s = f.s-s.s;
- tp.sx = f.sx-s.sx;
- } else if(c[0] == '+'){
- tp.s = f.s+s.s;
- tp.sx = f.sx+s.sx;
- }
- st.push(tp);
- } else if(c[0] == '*'){
- tp.m = f.m*s.m;
- tp.mx = f.mx*s.m+f.m*s.mx;
- tp.s = f.s*s.s;
- tp.sx = f.sx*s.s+f.s*s.sx;
- st.push(tp);
- } else if(c[0] == '/'){
- tp.m = f.m*s.s;
- tp.mx = f.mx*s.s+f.m*s.sx;
- tp.s = f.s*s.m;
- tp.sx = f.sx*s.m+f.s*s.mx;
- st.push(tp);
- }
- }
- }
- tp = st.top();
- printf("%lld\n", (tp.m*res-tp.s)/(tp.sx-tp.mx*res));
- return 0;
- }
#include <stdio.h>
#include <stack>
// case 5, 7 is runtime error
struct number {
long long s, sx;
long long m, mx;
} tp, f, s;
char c[30];
int res;
long long g;
std::stack < number > st;
long long gcd(long long a, long long b){
long long t;
while(b>0){
t = b;
b = a%b;
a = t;
}
return a;
}
int main(){
int i, t;
while(scanf("%s", c)){
if(c[0] == 'x'){
tp.s = 0;
tp.sx = 1;
tp.m = 1;
tp.mx = 0;
st.push(tp);
} else if(c[0] == '=') {
scanf("%d", &res);
tp = st.top();
break;
} else if(c[0] >= '0' && c[0] <= '9') {
t = c[0]-'0';
for(i=1; c[i]!=0; i++){
t *= 10;
t += c[i]-'0';
}
tp.s = t;
tp.sx = 0;
tp.m = 1;
tp.mx = 0;
st.push(tp);
} else {
s = st.top();
st.pop();
f = st.top();
st.pop();
if(c[0] == '-' || c[0] == '+'){
if(f.mx){
g = s.m/gcd(gcd(f.m, f.mx), s.m);
f.m *= g;
f.mx *= g;
f.s *= g;
f.sx *= g;
s.sx = s.s*f.mx/s.m;
s.s = s.s*f.m/s.m;
} else if(s.mx){
g = f.m/gcd(gcd(s.m, s.mx), f.m);
s.m *= g;
s.mx *= g;
s.s *= g;
s.sx *= g;
f.sx = f.s*s.mx/f.m;
f.s = f.s*s.m/f.m;
} else {
g = f.m*s.m/gcd(f.m, s.m);
f.s *= g/f.m;
f.sx *= g/f.m;
s.s *= g/s.m;
s.sx *= g/s.m;
f.m = s.m = g;
}
tp.m = f.m;
tp.mx = f.mx;
if(c[0] == '-'){
tp.s = f.s-s.s;
tp.sx = f.sx-s.sx;
} else if(c[0] == '+'){
tp.s = f.s+s.s;
tp.sx = f.sx+s.sx;
}
st.push(tp);
} else if(c[0] == '*'){
tp.m = f.m*s.m;
tp.mx = f.mx*s.m+f.m*s.mx;
tp.s = f.s*s.s;
tp.sx = f.sx*s.s+f.s*s.sx;
st.push(tp);
} else if(c[0] == '/'){
tp.m = f.m*s.s;
tp.mx = f.mx*s.s+f.m*s.sx;
tp.s = f.s*s.m;
tp.sx = f.sx*s.m+f.s*s.mx;
st.push(tp);
}
}
}
tp = st.top();
printf("%lld\n", (tp.m*res-tp.s)/(tp.sx-tp.mx*res));
return 0;
}
';
print "
3. Special Pizza (by gs11103)
";
print'
- #include <stdio.h>
- long long int M;
- long long int C[55], p[55];
- int ncr(int n, int r){
- long long int j,t=n,s=1;
- for(j=1;j<=r;j++){
- s=s*t/j;
- t--;
- C[j]=s;
- }
- return 0;
- }
- int pizza(int n, int k){
- if(k==0) return 0;
- long long int j,res1=1,res2=1;
- for(j=1;j<=n;j++) res1=(res1*(k-1))%M;
- if(n%2==0) res2=(k-1)%M;
- else res2=(1-k)%M;
- if((res1+res2)%M<0) return ((res1+res2)%M)+M;
- else return (res1+res2)%M;
- }
-
- int main(){
- long long int n,k,i,res;
- scanf("%lld%lld%lld",&n,&k,&M);
- if(n==1){
- if(k==1){
- printf("%lld",1%M);
- return 0;
- }
- else{
- printf("0");
- return 0;
- }
- }
- if(n<k){
- printf("0");
- return 0;
- }
- for(i=k;i>=0;i--){
- p[i]=pizza(n,i);
- }
- for(i=1;i<=k;i++) C[i]%=M;
- res = p[k];
- ncr(k,k);
- C[0]=1;
- for(i=k-1;i>=0;i=i-2){
- res+=((-C[i])*p[i]+C[i-1]*p[i-1])%M;
- }
- if(res%M<0) printf("%lld\n",(res%M)+M);
- else printf("%lld\n",res%M);
- return 0;
- }
#include <stdio.h>
long long int M;
long long int C[55], p[55];
int ncr(int n, int r){
long long int j,t=n,s=1;
for(j=1;j<=r;j++){
s=s*t/j;
t--;
C[j]=s;
}
return 0;
}
int pizza(int n, int k){
if(k==0) return 0;
long long int j,res1=1,res2=1;
for(j=1;j<=n;j++) res1=(res1*(k-1))%M;
if(n%2==0) res2=(k-1)%M;
else res2=(1-k)%M;
if((res1+res2)%M<0) return ((res1+res2)%M)+M;
else return (res1+res2)%M;
}
int main(){
long long int n,k,i,res;
scanf("%lld%lld%lld",&n,&k,&M);
if(n==1){
if(k==1){
printf("%lld",1%M);
return 0;
}
else{
printf("0");
return 0;
}
}
if(n<k){
printf("0");
return 0;
}
for(i=k;i>=0;i--){
p[i]=pizza(n,i);
}
for(i=1;i<=k;i++) C[i]%=M;
res = p[k];
ncr(k,k);
C[0]=1;
for(i=k-1;i>=0;i=i-2){
res+=((-C[i])*p[i]+C[i-1]*p[i-1])%M;
}
if(res%M<0) printf("%lld\n",(res%M)+M);
else printf("%lld\n",res%M);
return 0;
}
';
print "
4. Explosion (by k5888200)
";
print'
- #include <stdio.h>
-
- int n,N=1;
-
- struct Queue{
- int a[21][21],cnt;
- }queue[100000];
-
- int check(int x){
- int i,j;
- for(i=1;i<n;i++)
- for(j=1;j<=n;j++)
- if(queue[x].a[i][j]==1 && queue[x].a[i+1][j]==0)
- return 0;
- return 1;
- }
- void R(int x){
- int i,j;
- N++;
- for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[j][n-i+1]=queue[x].a[i][j];
- queue[N].cnt=queue[x].cnt+1;
- }
- void L(int x){
- int i,j;
- N++;
- for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[i][j]=queue[x].a[j][n-i+1];
- queue[N].cnt=queue[x].cnt+1;
- }
- void D(int x){
- int i,j;
- queue[++N]=queue[x]; queue[N].cnt++;
- 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;
- }
- void print(int x){
- int i,j;
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++) printf("%d",queue[x].a[i][j]);
- printf("\n");
- }
- printf("\n");
- }
-
- int main(){
-
- int i,j;
-
- scanf("%d",&n);
- for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%1d",&queue[1].a[i][j]);
-
- for(i=1;i<=N;i++){
- D(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
- R(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
- L(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
- }
- }
#include <stdio.h>
int n,N=1;
struct Queue{
int a[21][21],cnt;
}queue[100000];
int check(int x){
int i,j;
for(i=1;i<n;i++)
for(j=1;j<=n;j++)
if(queue[x].a[i][j]==1 && queue[x].a[i+1][j]==0)
return 0;
return 1;
}
void R(int x){
int i,j;
N++;
for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[j][n-i+1]=queue[x].a[i][j];
queue[N].cnt=queue[x].cnt+1;
}
void L(int x){
int i,j;
N++;
for(i=1;i<=n;i++) for(j=1;j<=n;j++) queue[N].a[i][j]=queue[x].a[j][n-i+1];
queue[N].cnt=queue[x].cnt+1;
}
void D(int x){
int i,j;
queue[++N]=queue[x]; queue[N].cnt++;
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;
}
void print(int x){
int i,j;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++) printf("%d",queue[x].a[i][j]);
printf("\n");
}
printf("\n");
}
int main(){
int i,j;
scanf("%d",&n);
for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%1d",&queue[1].a[i][j]);
for(i=1;i<=N;i++){
D(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
R(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
L(i); if(check(N)){printf("%d",queue[N].cnt); return 0;}
}
}
';
print "
5. Bingo Card
- There is not a perfact Solution!! Try solve!! -";
print "
�� �ع��� �м��Ͽ� ������ �����սô�. ���� ��ϵǸ� �����ϼ���!!";
print '';
?>