Problem 1002 搞了快一天了,测试数据都对的了啊,为什么wa

lj102800 | 2016-05-09 17:13:56Author
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> #include <queue> #include <string> #include <map> #include <stack> #include <list> #include <set> using namespace std; int main(){ const int MAXN = 1e5 + 10; int i; char s_decrypt[MAXN]; int T = 0,N=1; scanf("%d", &T); while (T--) { getchar(); gets(s_decrypt); scanf("%d", &i); int len = strlen(s_decrypt); int v = len % i==0?len/i:len/i+1; int yu = len%i; char decrypt[5010]; int z = 0; int count = 0; for (int k = 0; k < i; k++) { for (int j = 0; j < v; j++) { if (k + i*j < len){ decrypt[k + i*j] = s_decrypt[z++]; count++; } } } decrypt[len] = '\0'; printf("Case #%d:\n%s\n", N++, decrypt); } return 0; }
lj102800 | 2016-05-09 17:38:17# 1
我自己解决了,是char decrypt[5010]; 写小了