WA求助

P1319 压缩技术

yzm0325 @ 2023-01-27 14:06:50

#include <iostream>
#include <cstring>
using namespace std;
int a[40010], n, zt = 0, iindex = 0, m;
int main() {
    cin >> n;
    memset(a, 0, sizeof(a));
    for(; ; ) {
        cin >> m;
        for(int i = 1; i <= m; i++) a[i] = zt;
        zt = !zt, iindex += m;
        if(iindex = n * n) break;
    }
    int j = 1;
    for(int i = 1; i <= n; i++) {
        for(; j <= n; j++) cout << a << " ";
        cout << endl;
    }
    return 0;
}

0分求助


by yzm0325 @ 2023-01-27 14:41:59

@Offending_username 第12行的问题看到了,现在20分


by Offending_user_name_ @ 2023-01-27 14:43:22

@Zhuyiming0325 我可不算白嫖你代码,我去年8月就A了一遍


by Offending_user_name_ @ 2023-01-27 14:44:26

@Zhuyiming0325 第10行你的i是从哪开始的,但你要储存在哪里。


by yzm0325 @ 2023-01-27 14:52:02

@Offending_username 知道你不是白嫖,可还是20```cpp

include <iostream>

include <cstring>

using namespace std; int a[40010], n, iindex, m; int zt = 0; int main() { cin >> n; memset(a, 0, sizeof(a)); int i; while(1) { cin >> m; for(; i <= m; i++) a[i] = zt; zt = !zt; iindex += m; if(n n == iindex) break; } for(i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) cout << a[j + (i - 1) n]; cout << endl; } return 0; }


by yzm0325 @ 2023-01-27 14:52:43

艹这个格式

#include <iostream>
#include <cstring>
using namespace std;
int a[40010], n, iindex, m;
int zt = 0;
int main() {
    cin >> n;
    memset(a, 0, sizeof(a));
    int i;
    while(1) {
        cin >> m;
        for(; i <= m; i++) a[i] = zt;
        zt = !zt; iindex += m;
        if(n * n == iindex) break;
    }
    for(i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) cout << a[j + (i - 1) * n];
        cout << endl;
    }
    return 0;
}

by Offending_user_name_ @ 2023-01-28 08:28:40

@Zhuyiming0325 第12行a[i]改成a[i+iindex](别忘了关注我)


by Offending_user_name_ @ 2023-01-28 08:31:48

@Zhuyiming0325 好吧我不强求,因为你关注的都是管理


by yzm0325 @ 2023-01-29 18:01:32

关了


by yzm0325 @ 2023-01-29 18:03:51

hhh谢谢AC了,也关注你了


by yzm0325 @ 2025-01-04 14:19:05

考个古(?


上一页 |