在自己的IDE可以過範例測資,到這裡連測試執行就過不了?????
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define int unsigned long long
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;
cin >> T;
cin.ignore();
char s;
while (T--) {
int ans = 0;
int ocount = 0;
int wcount = 0;
while (true) {
s=getchar();
if (s == 'O') {
ocount++;
ans += wcount;
ans %= MOD;
} else if (s == 'w') {
wcount += ocount;
}else if (s == '\n') {
break;
}
}
cout << ans << "\n";
}
}
在自己的IDE可以過範例測資,到這裡連測試執行就過不了?????
#include
using namespace std;
#define MOD 1000000007
#define int unsigned long long
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;
cin >> T;
cin.ignore();
char s;
while (T--) {
int ans = 0;
int ocount = 0;
int wcount = 0;
while (true) {
s=getchar();
if (s == 'O') {
ocount++;
ans += wcount;
ans %= MOD;
} else if (s == 'w') {
wcount += ocount;
}else if (s == '\n') {
break;
}
}
cout << ans << "\n";
}
}
不用這個就可以跑了
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
但不知道為什麼?