Submission #891678
Source Code Expand
#include <iostream> #include <cstdio> #include <string> #include <string.h> #include <queue> #include <math.h> #include <cmath> #include <map> #include <set> #include <vector> #include <algorithm> #include <bitset> #include <list> #include <ctype.h> #include <cassert> #include <stack> #include <fstream> #include <unordered_map> #include <unordered_set> #include <ctime> #include <functional> #include <ctime> #include <limits> #include <tuple> #include <complex> #include <numeric> using namespace std; #define snd second #define fst first #define mp make_pair #define ll long long #define ull unsigned long long #define ld long double #define pb push_back #define left _left #define right _right const ld pi = acos(-1.0l); template<typename T> T abs(T x) { return x > 0 ? x : -x; } template<typename T> T sqr(T x) { return x * x; } template<typename T> bool chmin(T &x, T y) { if (x > y) { x = y; return true; } return false; } template<typename T> bool chmax(T &x, T y) { if (x < y) { x = y; return true; } return false; } template<typename U, typename V> ostream &operator<<(ostream &s, const pair<U, V> &x) { s << "(" << x.fst << ", " << x.snd << ")"; return s; } template<typename U> ostream &operator<<(ostream &s, const vector<U> &x) { s << "["; bool was = false; for (auto it : x) { if (was) { s << ", "; } was = true; s << it; } s << "]"; return s; } template<typename U> ostream &operator<<(ostream &s, const set<U> &x) { s << "{"; bool was = false; for (auto it : x) { if (was) { s << ", "; } was = true; s << it; } s << "}"; return s; } template<int sz> ostream operator<<(ostream &s, const bitset<sz> &x) { for (int i = 0; i < sz; i++) { s << x[i]; } return s; } //----------------------------------------------------------------------------- int main() { srand(time(NULL)); retry: #ifdef LOCAL // gen(); freopen("a.in", "r", stdin); //freopen("a.out", "w", stdout); #else //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); #endif string s; cin >> s; int k; cin >> k; for (int i = 0; i < s.size(); i++) { int need = 'z' - s[i] + 1; if (need <= k) { s[i] = 'a'; k -= need; } } k %= 26; s.back() += k; if (s.back() > 'z') { s.back() -= 26; } cout << s << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Next Letter |
User | avolchek |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2729 Byte |
Status | WA |
Exec Time | 6 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 3 ms | 256 KB |
0_01.txt | AC | 3 ms | 256 KB |
0_02.txt | AC | 3 ms | 256 KB |
1_00.txt | AC | 3 ms | 256 KB |
1_01.txt | AC | 3 ms | 256 KB |
1_02.txt | AC | 3 ms | 256 KB |
1_03.txt | AC | 3 ms | 256 KB |
1_04.txt | AC | 3 ms | 256 KB |
1_05.txt | AC | 3 ms | 256 KB |
1_06.txt | AC | 6 ms | 512 KB |
1_07.txt | AC | 6 ms | 512 KB |
1_08.txt | WA | 6 ms | 512 KB |
1_09.txt | WA | 6 ms | 512 KB |
1_10.txt | WA | 6 ms | 512 KB |
1_11.txt | WA | 6 ms | 512 KB |
1_12.txt | WA | 6 ms | 512 KB |
1_13.txt | WA | 6 ms | 512 KB |
1_14.txt | WA | 6 ms | 512 KB |
1_15.txt | WA | 6 ms | 512 KB |
1_16.txt | AC | 6 ms | 512 KB |
1_17.txt | AC | 6 ms | 512 KB |
1_18.txt | AC | 6 ms | 512 KB |
1_19.txt | AC | 6 ms | 512 KB |
1_20.txt | AC | 6 ms | 512 KB |
1_21.txt | AC | 6 ms | 512 KB |
1_22.txt | AC | 6 ms | 512 KB |
1_23.txt | AC | 6 ms | 512 KB |