#38220: 測試都過不了


samlin961112@gmail.com (林哲甫)

學校 : 新北市私立南山高級中學
編號 : 220506
來源 : [219.70.213.92]
最後登入時間 :
2024-04-28 22:43:43
c412. 四、多麼OwO(OwO) -- 板橋高中模擬賽 | From: [219.70.213.92] | 發表日期 : 2023-11-04 22:54

在自己的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";
  }
}

 
#38232: Re: 測試都過不了


samlin961112@gmail.com (林哲甫)

學校 : 新北市私立南山高級中學
編號 : 220506
來源 : [219.70.213.92]
最後登入時間 :
2024-04-28 22:43:43
c412. 四、多麼OwO(OwO) -- 板橋高中模擬賽 | From: [219.70.213.92] | 發表日期 : 2023-11-05 21:48

在自己的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);

但不知道為什麼?

 
ZeroJudge Forum