提出 #895235


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

#define FOR(a, b, c) for(long long a=b;a<c;a++)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int main() {
	char a[100010];
	cin >> a;
	ll b;
	cin >> b;
	ll n = strlen(a);
	FOR(i, 0, n) {
		if ((long long)a[i]+b > 'z') {
			b-=('z'-a[i]+1);
			a[i] = 'a';
		}
	}
	b = b%26;
	while (b>0) {
		a[n-1] ++;
		b --;
		if (a[n-1] > 'z') {
			a[n-1] = 'a';
		}
	}
	cout << a << endl;
}

提出情報

提出日時
問題 C - 次のアルファベット
ユーザ elta19371277
言語 C++14 (GCC 5.4.1)
得点 0
コード長 514 Byte
結果 WA
実行時間 6 ms
メモリ 384 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 400
結果
AC × 3
AC × 19
WA × 8
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
0_00.txt AC 3 ms 384 KiB
0_01.txt AC 3 ms 256 KiB
0_02.txt AC 3 ms 256 KiB
1_00.txt AC 3 ms 256 KiB
1_01.txt AC 2 ms 256 KiB
1_02.txt AC 3 ms 256 KiB
1_03.txt AC 3 ms 256 KiB
1_04.txt AC 2 ms 256 KiB
1_05.txt AC 2 ms 256 KiB
1_06.txt AC 6 ms 384 KiB
1_07.txt AC 6 ms 384 KiB
1_08.txt WA 5 ms 384 KiB
1_09.txt WA 5 ms 384 KiB
1_10.txt WA 6 ms 384 KiB
1_11.txt WA 5 ms 384 KiB
1_12.txt WA 5 ms 384 KiB
1_13.txt WA 5 ms 384 KiB
1_14.txt WA 5 ms 384 KiB
1_15.txt WA 5 ms 384 KiB
1_16.txt AC 5 ms 384 KiB
1_17.txt AC 5 ms 384 KiB
1_18.txt AC 6 ms 384 KiB
1_19.txt AC 5 ms 384 KiB
1_20.txt AC 5 ms 384 KiB
1_21.txt AC 6 ms 384 KiB
1_22.txt AC 5 ms 384 KiB
1_23.txt AC 6 ms 384 KiB