print " 2ȸ ³ª´Â ÄÚ´õ´Ù °æ¿¬ÀÌ ³¡³µ½À´Ï´Ù. ¼ö°íÇϼ̽À´Ï´Ù.
";
print " ¾Æ·¡ Á¡¼ö´Â Âü¿©ÇÑ ¸ðµç ºÐ¿¡ ´ëÇÑ °á°úÀÔ´Ï´Ù.
´ÙÀ½¿¡ ÁغñÁßÀÎ ¸ðÀÇ°í»ç¿¡µµ Âü°¡ÇØ Áֽñ⠹ٶø´Ï´Ù.
";
print "
¹ü·Ê : o - Accepted, x - Wrong Answer, s - signal out(runtime error), t - Time Limit Exceeded
";
print "2ȸ ³ª´Â ÄÚ´õ´Ù!! ÃÖÁ¾°á°ú
";
print "¿ì½Â(1st place Gold) : dijkstra(715pts)
";
print "ÁØ¿ì½Â(2nd place Silver) : ryanch1(560pts)
";
print "3µî»ó(3rd place Bronze) : zlzmsrhak56(475pts), gs12059(460pts), makesource(460pts), gs12065(455pts), vega4792(390pts)
";
$dir="/var/www/bbs/moi/2nd/";
$pnum = 4;
$files1 = scandir($dir);
print 'Result for All Participant
user | Sum(200) | Ship Travelling(200) | Cutting Confectionery(300) | Comeback vault 101(300) | Score |
'.$files1[$i].' | '; for( $j=1 ; $j <= $pnum ; $j++ ) { if( $j>2 ) $sz = 30; else $sz = 15; print ''; $prob_result = $dir.$files1[$i].'/'.$files1[$i].'.res'.$j; if(file_exists($prob_result)==true) { $fp = fopen($prob_result, "r"); $str = fgets($fp, filesize($prob_result)+1); //print $str.""; for( $k=0; $k <= strlen($str) ; $k++ ) if(SUBSTR($str, $k, 1)== "o"){ print ''.SUBSTR($str, $k, 1).''; switch($j) { case 1: case 2: $score = $score + 20; break; case 3: case 4: $score = $score + 15; break; } } else if(SUBSTR($str, $k, 1)=="x") print ''.SUBSTR($str, $k, 1).''; else if(SUBSTR($str, $k, 1)=="t") print ''.SUBSTR($str, $k, 1).''; else if(SUBSTR($str, $k, 1)=="s") print ''.SUBSTR($str, $k, 1).''; } else print 'Not submited!!'; print ' | '; } print ''.$score.' | '; print "
#include <stdio.h> // this solution is dynamic programming using memory cutting! int n, i, front, cnt, sum; main() { scanf("%d",&n); for(i=1;i<=n;i++) { sum+=i; while(sum>n) sum-= ++front; if(sum==n) cnt++; } printf("%d",cnt); }
#include <stdio.h> // This is methmatical skill long long N; int count; int main(){ long long k; scanf("%lld",&N); for(k=1;k<=N;k++){ if( (2*N-k*k+k)%(2*k) ==0 && (2*N-k*k+k)/(2*k)>=1) count++; } printf("%d",count); return 0; }
#include<stdio.h> // This is SCC(Strongly Connected Component). Try seach SCC (using googling!!) #include<vector> using namespace std; vector<int> way[10005]; vector<int> bay[10005]; vector<int> nay[10005]; vector<int> stack; int num[10005],ad[10005],dy[10005],n,m,st,en,cnt=0; bool check[10005],sch,ech; void input() { int i,a,b; scanf("%d%d%d%d",&n,&m,&st,&en); for(i=0;i<m;i++){ scanf("%d%d",&a,&b); way[a].push_back(b); bay[b].push_back(a); } } void DFS(int x) { int i; for(i=0;i<way[x].size();i++){ if(check[way[x][i]])continue; check[way[x][i]]=true; DFS(way[x][i]); } stack.push_back(x); } void nDFS(int x) { if(x==st&&!sch){ st=cnt; sch=true; } if(x==en&&!ech){ en=cnt; ech=true; } int i; for(i=0;i<bay[x].size();i++){ if(ad[bay[x][i]]!=0&&ad[bay[x][i]]!=cnt&&(nay[ad[bay[x][i]]].empty()||nay[ad[bay[x][i]]].back()!=cnt)){ nay[ad[bay[x][i]]].push_back(cnt); } if(check[bay[x][i]])continue; check[bay[x][i]]=true; nDFS(bay[x][i]); } num[cnt]++; ad[x]=cnt; } void scc() { int i; for(i=1;i<=n;i++){ if(check[i])continue; check[i]=true; DFS(i); } for(i=1;i<=n;i++)check[i]=false; for(i=stack.size()-1;i>=0;i--){ if(check[stack[i]])continue; cnt++; check[stack[i]]=true; nDFS(stack[i]); } } void solve() { int i,j; dy[st]=num[st]; for(i=st;i<=en;i++){ for(j=0;j<nay[i].size();j++){ if(dy[nay[i][j]]<num[nay[i][j]]+dy[i])dy[nay[i][j]]=num[nay[i][j]]+dy[i]; } } printf("%d",dy[en]); } int main() { input(); scc(); solve(); return 0; }
#include<stdio.h> // This is Dynamic Programming (named Bitonic Tour) best solution!! #define max(a,b) (a>b?(a):(b)) int d[220][110][110],n,m; int s[110][110]; main() { int i,j,k; scanf("%d%d",&m,&n); for(i=1;i<=n;i++) for(j=1;j<=m;j++) scanf("%1d",&s[i][j]); for(i=1;i<=n;i++) for(j=1;j<=m;j++) s[i][j]=s[i][j]==1?1:s[i][j]==0?0:-1; for(k=2,d[1][1][1]=s[1][1]+1;k<n+m;k++) for(i=1;i<=n;i++) { if(s[i][k-i+1]==-1) continue; for(j=i;j<=n;j++) { int score=0; if(i!=j) score = s[i][k-i+1]+s[j][k-j+1]; else score = s[i][k-i+1]; if(s[j][k-j+1]==-1) continue; d[k][i][j] = max(d[k-1][i-1][j],max(d[k-1][i][j-1],max(d[k-1][i][j],d[k-1][i-1][j-1]))); d[k][i][j] = d[k][i][j]?d[k][i][j]+score:0; } } printf("%d\n",d[n+m-1][n][n]?d[n+m-1][n][n]-1:0); }