Fork me on GitHub

NYOJ题目273字母小游戏

AC代码如下:

------------------------------------

 1 import java.util.Scanner;
 2 
 3 public class Main {
 4 
 5     public static void main(String[] args) {
 6         
 7         Scanner sc=new Scanner(System.in);
 8         
 9         int n=Integer.parseInt(sc.nextLine());
10         
11         while(n-->0){
12             
13             String s=sc.nextLine();
14             
15             int round=0;
16             for(int i=0;i<s.length();i++){
17                 char c=s.charAt(i);
18                 if(c>='a' && c<='z') round=(round+1)%26;
19             }
20             
21             if(round==0){
22                 System.out.println("z");
23             }else{
24                 System.out.println(String.format("%c",'a'+round-1));
25             }
26             
27         }
28         
29     }
30     
31 }

题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=273

 

posted @ 2016-08-27 13:58  CC11001100  阅读(286)  评论(0编辑  收藏  举报