WA 71pts 求助!

P3392 涂条纹

(好像)发现了一组 hack 数据: ``` 3 3 RRR RRR RRR ``` 改完后 57pts,求指点!!!赏关注
by zym0325 @ 2023-07-02 19:12:35


好了,自己改过来了。 ```cpp #include <bits/stdc++.h> #define inf 1e9 using namespace std; int w[60], b[60], r[60], n, m, minn = inf; char c; int main() { cin >> n >> m; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) { cin >> c; if(c != 'W') w[i]++; if(c != 'B') b[i]++; if(c != 'R') r[i]++; } /*for(int i = 1; i <= n; i++) cout << w[i] << " "; cout << endl; for(int i = 1; i <= n; i++) cout << b[i] << " "; cout << endl; for(int i = 1; i <= n; i++) cout << r[i] << " "; cout << endl;*/ for(int i = 1; i <= n; i++) for(int j = i + 1; j < n; j++) { // <= -> < int now = 0; for(int x = 1; x <= i; x++) now += w[x]; for(int x = i + 1; x <= j; x++) now += b[x]; for(int x = j + 1; x <= n; x++) now += r[x]; if(now < minn) minn = now; } cout << minn; return 0; } ```
by zym0325 @ 2023-07-02 19:14:39


|