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 的用法

Pokemon Master的更多相关文章

  1. The 11th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Pokemon Master

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3776 题意:比较两组数据的总和大小. #include <iostr ...

  2. ZOJ 3776 A - Pokemon Master 签到水题

    link 求和比大小... /** @Date : 2017-03-23-21.26 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : http ...

  3. -------Pokemon Master------很水-------

    A - Pokemon Master Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Sta ...

  4. Bash's Big Day

    Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he we ...

  5. CodeForces757B

    B. Bash's Big Day time limit per test 2 seconds memory limit per test 512 megabytes input standard i ...

  6. CodeForces757A

    A. Gotta Catch Em' All! time limit per test 1 second memory limit per test 256 megabytes input stand ...

  7. 2012-2014 三年浙江 acm 省赛 题目 分类

    The 9th Zhejiang Provincial Collegiate Programming Contest A    Taxi Fare    25.57% (166/649)     (水 ...

  8. Codeforces 757B. Bash's Big Day GCD

    B. Bash's Big Day time limit per test:2 seconds memory limit per test:512 megabytes input:standard i ...

  9. 757A Gotta Catch Em' All!

    A. Gotta Catch Em' All! time limit per test 1 second memory limit per test 256 megabytes input stand ...

随机推荐

  1. selenium3 踩坑--move_to_element()报错

    问题:selenium3 使用move_to_element()报错,报错信息如下图所示: 网上没有找到合适的解决办法,回退到稳定的selenium2可以解决. pip install seleniu ...

  2. Linux 批量替换的一种实现方式

    替换某目录下所有文件中的某个字符: sed -i 's/origin_str/new_str/g' `grep origin_str -rl ./` origin_str:被替换的字符串: new_s ...

  3. PHP 获取网络接口文件流

    获取网络接口里面的文件流 php开发调用各种接口在所难免,有时须要传递非常多參数. 在传递參数过程中 '&' 有时会被 解析成 '&'导致请求失败 经过查找资料和比較,发现php提供了 ...

  4. 九度OJ 1057:众数 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8431 解决:2819 题目描述: 输入20个数,每个数都在1-10之间,求1-10中的众数(众数就是出现次数最多的数,如果存在一样多次数的 ...

  5. 偏函数应用 pfa

  6. thinkphp5, 结合pgsql使用时, 要先运行这段sql代码

    按照tp5的官方文档的说法, 必须这么做: 先执行一段sql代码 CREATE OR REPLACE FUNCTION pgsql_type(a_type varchar) RETURNS varch ...

  7. 【题解】P2602[JZOI2010]数字计数

    [题解][P2602ZJOI2010]数字计数 乍看此题,感觉直接从数字的位上面动手,感觉应该很容易. 但是仔细看数据范围,发现如果不利用计数原理,肯定会超时,考虑数码出现的特征: \(A000\)到 ...

  8. 如何在MySQL中分配innodb_buffer_pool_size

    如何在MySQL中分配innodb_buffer_pool_size innodb_buffer_pool_size是整个MySQL服务器最重要的变量. 1. 为什么需要innodb buffer p ...

  9. log4j 2 入门实例(1)

    本文介绍log4j的基本概念和将日志输出到控制台的例子. 参考文章: http://www.jianshu.com/p/464058bdbc76 http://www.hankcs.com/progr ...

  10. contenttype应用 , 缓存相关

    一. Django的contenttypes contenttypes 是Django内置的一个应用,可以追踪项目中所有 app和model 的对应关系,并记录在 django_content_typ ...