Submission #3699964
Source Code Expand
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
cin.tie(0); ios::sync_with_stdio(false);
freopen("input.txt", "r", stdin);
int t; cin >> t;
vector<string> str(t); REP(i, t) cin >> str[i];
REP(i, t) {
int ans = 0;
int tokyo = str[i].find("tokyo"), kyoto = str[i].find("kyoto");
while (tokyo != str[i].npos || kyoto != str[i].npos) {
++ans;
if (tokyo != str[i].npos && kyoto != str[i].npos) {
if (tokyo < kyoto) {
int temp = tokyo;
tokyo = str[i].find("tokyo", temp + 5);
kyoto = str[i].find("kyoto", temp + 5);
} else {
int temp = kyoto;
tokyo = str[i].find("tokyo", temp + 5);
kyoto = str[i].find("kyoto", temp + 5);
}
} else if (tokyo != str[i].npos) {
tokyo = str[i].find("tokyo", tokyo + 5);
} else {
kyoto = str[i].find("kyoto", kyoto + 5);
}
}
cout << ans << "\n";
}
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 東京都 |
User |
emthrm |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1496 Byte |
Status |
RE |
Exec Time |
98 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:35: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("input.txt", "r", stdin);
^
Judge Result
Set Name |
All |
Score / Max Score |
0 / 100 |
Status |
|
Set Name |
Test Cases |
All |
10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt |
Case Name |
Status |
Exec Time |
Memory |
10_random_to_kyo.txt |
RE |
98 ms |
256 KB |
20_noised_tokyoto.txt |
RE |
98 ms |
256 KB |
99_teuchi.txt |
RE |
98 ms |
256 KB |