Submission #901204
Source Code Expand
#coding: utf-8
s=gets().chomp()
k=gets().chomp().to_i
i=0
while(i<s.length && k>0)
if(s[i]!="a"&&"z".ord - s[i].ord + 1<= k)
k -= ("z".ord - s[i].ord + 1)
s[i]="a"
end
i+=1
end
if(k != 0)
k= k%26
s[-1] = ((s[-1].ord + k) <= "z".ord ? (s[-1].ord + k).chr : (s[-1].ord + k - 26).chr)
end
puts(s)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Next Letter |
| User | misaka666 |
| Language | Ruby (2.3.3) |
| Score | 400 |
| Code Size | 319 Byte |
| Status | AC |
| Exec Time | 910 ms |
| Memory | 2044 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 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 | 11 ms | 1788 KiB |
| 0_01.txt | AC | 11 ms | 1788 KiB |
| 0_02.txt | AC | 11 ms | 1788 KiB |
| 1_00.txt | AC | 11 ms | 1788 KiB |
| 1_01.txt | AC | 11 ms | 1788 KiB |
| 1_02.txt | AC | 11 ms | 1788 KiB |
| 1_03.txt | AC | 11 ms | 1788 KiB |
| 1_04.txt | AC | 11 ms | 1788 KiB |
| 1_05.txt | AC | 11 ms | 1788 KiB |
| 1_06.txt | AC | 30 ms | 2044 KiB |
| 1_07.txt | AC | 910 ms | 2044 KiB |
| 1_08.txt | AC | 206 ms | 2044 KiB |
| 1_09.txt | AC | 169 ms | 2044 KiB |
| 1_10.txt | AC | 113 ms | 2044 KiB |
| 1_11.txt | AC | 361 ms | 2044 KiB |
| 1_12.txt | AC | 57 ms | 2044 KiB |
| 1_13.txt | AC | 138 ms | 2044 KiB |
| 1_14.txt | AC | 726 ms | 2044 KiB |
| 1_15.txt | AC | 782 ms | 2044 KiB |
| 1_16.txt | AC | 837 ms | 2044 KiB |
| 1_17.txt | AC | 836 ms | 2044 KiB |
| 1_18.txt | AC | 820 ms | 2044 KiB |
| 1_19.txt | AC | 876 ms | 2044 KiB |
| 1_20.txt | AC | 742 ms | 2044 KiB |
| 1_21.txt | AC | 861 ms | 2044 KiB |
| 1_22.txt | AC | 812 ms | 2044 KiB |
| 1_23.txt | AC | 806 ms | 2044 KiB |