Submission #896223


Source Code Expand

Copy
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String s = sc.next();
int K = sc.nextInt();
Random random = new Random();
if((1<=s.length() && s.length()<=100000) &&(1<=K && K<=1000000000) && (s.equals(s.toLowerCase()))){
for(int i=1;i<K;i++){
int randomValue = 1 + random.nextInt((s.length() - 1));
s = s.substring(0,randomValue)+ Character.valueOf((char) (((int)s.charAt(randomValue)+1)%25 + 97)) +s.substring(randomValue+1);
}
System.out.println(s);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
import java.util.Random;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int K = sc.nextInt();
		 Random random = new Random();

		if((1<=s.length() && s.length()<=100000) &&(1<=K && K<=1000000000) && (s.equals(s.toLowerCase()))){
			for(int i=1;i<K;i++){
				int randomValue = 1 + random.nextInt((s.length() - 1));
				s = s.substring(0,randomValue)+ Character.valueOf((char) (((int)s.charAt(randomValue)+1)%25 + 97)) +s.substring(randomValue+1);
			}
			System.out.println(s);
		}
	}
	

}

Submission Info

Submission Time
Task C - Next Letter
User doduytu
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 660 Byte
Status WA
Exec Time 2121 ms
Memory 331700 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
WA × 2
RE × 1
WA × 4
TLE × 18
RE × 5
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 125 ms 9680 KB
0_01.txt RE 127 ms 9808 KB
0_02.txt WA 126 ms 9680 KB
1_00.txt WA 126 ms 9676 KB
1_01.txt WA 126 ms 9672 KB
1_02.txt RE 125 ms 9808 KB
1_03.txt RE 125 ms 9684 KB
1_04.txt RE 127 ms 9676 KB
1_05.txt RE 124 ms 9684 KB
1_06.txt TLE 2121 ms 330856 KB
1_07.txt TLE 2121 ms 330300 KB
1_08.txt TLE 2121 ms 330840 KB
1_09.txt TLE 2121 ms 330876 KB
1_10.txt TLE 2121 ms 330688 KB
1_11.txt TLE 2121 ms 330712 KB
1_12.txt TLE 2121 ms 331140 KB
1_13.txt TLE 2121 ms 330992 KB
1_14.txt TLE 2121 ms 331096 KB
1_15.txt TLE 2121 ms 331076 KB
1_16.txt TLE 2121 ms 330528 KB
1_17.txt TLE 2121 ms 331536 KB
1_18.txt TLE 2121 ms 331496 KB
1_19.txt TLE 2121 ms 331700 KB
1_20.txt TLE 2121 ms 331604 KB
1_21.txt TLE 2121 ms 330528 KB
1_22.txt TLE 2121 ms 331008 KB
1_23.txt TLE 2121 ms 331524 KB


2025-02-28 (Fri)
11:22:05 +00:00