Submission #1610242
Source Code Expand
#define _USE_MATH_DEFINES #include <iostream> #include <algorithm> #include <cmath> #include <string> #include <utility> #include <climits> #include <vector> #include <map> using namespace std; #define ll long long const int MOD = 1000000007;//10^9+7 int max(int a, int b) { if (a > b)return a; else return b; } //aとbの大きい方 int min(int a, int b) { if (a < b)return a; else return b; } //aとbの小さい方 int avd_i(int a, int b) { if (a > b)return a - b; else return b - a; } double avd_d(double a, double b) { double re; if (a > b)re = a - b; else re = b - a; return re; } //aとbの差の絶対値 ll powsur(ll a, ll b, ll p) { if (b == 0) { return 1; } else if (b % 2 == 0) { ll d = powsur(a, b / 2, p); return ((d%p)*(d%p)) % p; } else { return ((a%p)*powsur(a, b - 1, p) % p) % p; } } //pは素数,aのb乗をpで割った余り ll CMOD(ll n, ll r, ll p) { ll a = 1, b = 1, c = 1, re; for (int i = 1; i <= n; i++) { a *= i; a = a%p; } for (int i = 1; i <= r; i++) { b *= i; b = b%p; } for (int i = 1; i <= n - r; i++) { c *= i; c = c%p; } b = powsur(b, p - 2, p); c = powsur(c, p - 2, p); re = ((a%p)*(b%p)) % p; re = ((re%p)*c%p) % p; return re; } //pは素数,(nCr)%p int main() { string S; ll K; cin >> S >> K; for (int i = 0; i < S.size(); i++) { if ((int)S[i] - 'a' <= 13) { if ((int)S[i] - 'a' <= K) { K -= (int)S[i] - 'a'; S[i] = 'a'; } else { S[i] = (char)((int)S[i] - K); K = 0; } } else { if (26 - ((int)S[i] - 'a') <= K) { K -= 26 - ((int)S[i] - 'a'); S[i] = 'a'; } else { S[i] = (char)((int)S[i] - K); K = 0; } } } cout << S << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Next Letter |
User | pelno |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1895 Byte |
Status | WA |
Exec Time | 5 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 | WA | 1 ms | 256 KB |
0_01.txt | WA | 1 ms | 256 KB |
0_02.txt | WA | 1 ms | 256 KB |
1_00.txt | WA | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | WA | 1 ms | 256 KB |
1_04.txt | WA | 1 ms | 256 KB |
1_05.txt | WA | 1 ms | 256 KB |
1_06.txt | WA | 5 ms | 512 KB |
1_07.txt | WA | 5 ms | 512 KB |
1_08.txt | WA | 5 ms | 512 KB |
1_09.txt | WA | 5 ms | 512 KB |
1_10.txt | WA | 5 ms | 512 KB |
1_11.txt | WA | 5 ms | 512 KB |
1_12.txt | WA | 5 ms | 512 KB |
1_13.txt | WA | 5 ms | 512 KB |
1_14.txt | WA | 5 ms | 512 KB |
1_15.txt | WA | 5 ms | 512 KB |
1_16.txt | WA | 5 ms | 512 KB |
1_17.txt | WA | 5 ms | 512 KB |
1_18.txt | WA | 5 ms | 512 KB |
1_19.txt | WA | 5 ms | 512 KB |
1_20.txt | WA | 5 ms | 512 KB |
1_21.txt | WA | 5 ms | 512 KB |
1_22.txt | WA | 5 ms | 512 KB |
1_23.txt | WA | 5 ms | 512 KB |