标签:load can new image static 笔试 int mamicode ann
此博客链接:
题解:
找大写26个字母的位置,26个字母可以重复M个
输入为N M,N测试用例个数,M为字母重复个数,
输出字母和处于第几位
代码
public class leetcode {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = 0, c = 0;
// char ch[]=new char[26];
char ch[] = { ‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘, ‘G‘, ‘H‘, ‘I‘, ‘G‘, ‘K‘,
‘L‘, ‘M‘, ‘N‘, ‘O‘, ‘P‘, ‘Q‘, ‘R‘, ‘S‘, ‘T‘, ‘U‘, ‘V‘, ‘W‘,
‘X‘, ‘Y‘, ‘Z‘ };
while (scanner.hasNextInt()) {
n = scanner.nextInt();
c = scanner.nextInt();
// System.out.println(n);
// System.out.println(c);
for (int i = 0; i < n; i++) {
int a = scanner.nextInt();
int num = a / c;
int nums = a % c;
System.out.print(ch[num]);
System.out.print(nums);
// System.out.println();
}
}
// System.out.println("nihao ");
// int[][] prices = new int[6][2];
}
}
结果
标签:load can new image static 笔试 int mamicode ann
原文地址:https://www.cnblogs.com/ping2yingshi/p/14702766.html