Submission #17508236
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const ll base = 998244353;
ll mod = 1e9 + 7;
const ld eps = 1e-9;
void solve() {
string s; cin >> s;
string t = "atcoder";
if (t < s) {
cout << 0 << endl;
return;
}
for (int i = 0; i < s.size(); ++i) {
if (s[i] != 'a') {
if (i > 0 && s[i] > 't') {
cout << i - 1 << endl;
} else {
cout << i << endl;
}
return;
}
}
cout << -1 << endl;
}
int main() {
srand(time(NULL));
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::random_device rd;
std::mt19937 g(rd());
auto start = clock();
ll t = 1;
cin >> t;
while(t--) {
solve();
}
// std::cerr << ld(clock() - start) / CLOCKS_PER_SEC << std::endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - atcoder < S |
| User | PuRpLe_FoReVeR |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 1185 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 3564 KiB |
Compile Error
./Main.cpp: In function ‘void solve()’:
./Main.cpp:32:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
32 | for (int i = 0; i < s.size(); ++i) {
| ~~^~~~~~~~~~
./Main.cpp: In function ‘int main()’:
./Main.cpp:58:10: warning: unused variable ‘start’ [-Wunused-variable]
58 | auto start = clock();
| ^~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt |
| All | 00-sample-001.txt, 01-001.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 3 ms | 3512 KiB |
| 01-001.txt | AC | 2 ms | 3564 KiB |