| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
3617一直WA在本地上用vs测试一些小数据都是对的(应该是个小错误但是一直没找到):
/** poj 3617 best cow line一直WA
* 05.05/2014
*/
#include <stdio.h>
#include <string.h>
#define MAXN 4000
#define INF 100000000
int N;
char ca[MAXN];
void solve()
{
int starti = 0,endi = N-1;
int count = 0;
while (starti <= endi)
{
for(int i =0; starti + i <= endi; i++)
{
if(ca[starti + i] <= ca[endi-i])
{
putchar(ca[starti ++]);count++;
break;
}
else
{
putchar(ca[endi --]);count++;
break;
}
}
if(count == 80)
{
putchar('\n');
count =0;
}
}
putchar('\n');
return;
}
int main()
{
scanf("%d",&N);
//scanf("%s",ca);
for(int i = 0; i < N; i++)
scanf("\n%c",&ca[i]);
solve();
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator