• Pokemon Master


    Pokemon Master
    
    Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other)
    Total Submission(s) : 15   Accepted Submission(s) : 8
    Problem Description
    Calem and Serena are pokemon masters. One day they decided to have a pokemon battle practice before Pokemon World Championships. Each of them has some pokemons in each's team. To make the battle more interesting, they decided to use a special rule to determine the winner: the team with heavier total weight will win the battle!
    Input
    There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
    The first line contains two integers N and M (1 <= N, M <= 6), which describes that Calem has N pokemons and Serena has M pokemons.
    The second line contains N integers indicating the weight of Calem's pokemons. The third line contains M integers indicating the weight of Serena's pokemons. All pokemons' weight are in the range of [1, 2094] pounds.
    Output
    For each test case, output "Calem" if Calem's team will win the battle, or "Serena" if Serena's team will win. If the two team have the same total weight, output "Draw" instead.
    Sample Input
    1
    6 6
    13 220 199 188 269 1014
    101 176 130 220 881 396
    Sample Output
    Serena
     
    package ACM1;
    
    
    import java.text.DecimalFormat;
    import java.util.ArrayList;
    import java.util.Scanner;
    
    
    
    public class nyojw2
    {
      public static void main(String[]args)
      {
          Scanner scanner = new Scanner(System.in);
          int t = scanner.nextInt();
          for(int i=0;i<t;i++)
          {
             int n = scanner.nextInt();
             int m = scanner.nextInt();
             int sum1=0;
             int sum2=0;
             for(int j=0;j<n;j++)
             {
                 sum1=sum1+scanner.nextInt();
                 
             }
             for(int j=0;j<m;j++)
             {
                 
                 sum2=sum2+scanner.nextInt();
             }
             if(sum1==sum2)
                 System.out.println("Draw");
             if(sum1<sum2)
                 System.out.println("Serena");
             if(sum1>sum2)
                 System.out.println("Calem");
              
          }
          
      }
    }

    当java的数组用不明白的时候减少用数组的频率,因当学一下ArryList 的用法

  • 相关阅读:
    DigitalOcean上使用Tornado+MongoDB+Nginx+Supervisor+DnsPod快速搭建个人博客
    创业三年来的一些感想
    创业三年来的一些感想
    ViEmuVS2013-3.2.1 破解
    瘋子C语言笔记(指针篇)
    瘋子C语言笔记(结构体/共用体/枚举篇)
    瘋子C++笔记
    petalinux add pre-build application to rootfs compile faliure solution
    QA Issue: No GNU_HASH in the elf binary
    视觉SLAM——特征点法与直接法对比以及主流开源方案对比 ORB LSD SVO DSO
  • 原文地址:https://www.cnblogs.com/mmlovejj/p/4445470.html
Copyright © 2020-2023  润新知