Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 1402 | Accepted: 545 |
Description
企鹅大学有很多很多名学生,课程也很多。譬如企鹅语,北极熊语,企鹅初级数学,企鹅高级数学等等等等…… 现在,企鹅大学的校长想请你为他们写一个程序:计算总分的程序。请你由他们输入课程的数量以及一个学生每门课程的分数,输出该学生的总分。
Input
第2至第 n+1行:每行有一个1整数,第 i+1行代表某一位学生在第 i门课上取得的分数。分数为0到100的整数。
Output
Sample Input
3 100 99 100
Sample Output
299
Problem B: Doudou
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 1724 | Accepted: 198 |
Description
有只企鹅叫豆豆,总是被别的企鹅欺负。豆豆在长期的隐忍之后,掌握了所有企鹅的高度和攻击力强度,还得到了一把黄金剑。在拥有了黄金剑以后,豆豆终于可以展开绝地大反击。但这把黄金剑的用法却很奇怪。
首先,豆豆第一次可以选择任何一只企鹅开始挑战。豆豆这一次必胜。
再次,当豆豆已经挑战过某一只企鹅后,再下一次的挑战对象只能是比上一名对手高,且比上一名对手攻击力强的企鹅。这样豆豆必胜。否则黄金剑会觉得打的没意思而故意发脾气输掉。豆豆还会被大家集体暴打。
面对着这把脾气很大的黄金剑,豆豆想请你帮助他计算一下,他最多可以连续击败多少只企鹅?
Input
Output
Sample Input
Sample Input #1 | Sample Input #2 |
3 1 3 3 2 2 4 | 5 10 1 9 2 7 3 6 4 5 5 |
Sample Output
Sample Output #1 | Sample Output #2 |
2 | 1 |
import java.io.*;
import java.util.*;
public class Main
{
static int[] shengao;
static int[] liqi;
static int[] check = new int[1000];
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
shengao = new int[n];
liqi = new int[n];
for (int i = 0; i < n; i++)
{
shengao[i] = cin.nextInt();
liqi[i] = cin.nextInt();
}
int max = 1;
for (int i = 0; i < n; i++)
{
if (check(i, n) > max)
max = check(i, n);
}
System.out.println(max);
}
static int check(int i, int n)
{
if (check[i] == 0)
{
int[] array = new int[10000];
int geshu = 0;
for (int j = 0, temp = 0; j < n; j++)
{
if (liqi[j] > liqi[i] && shengao[j] > shengao[i])
{
array[temp] = j;
temp++;
geshu++;
}
}
int max = 0;
for (int j = 0; j < geshu; j++)
{
int temp = check(array[j], n);
if (temp > max)
max = temp;
}
if (geshu == 0)
{
check[i] = 1;
return 1;
}
else
{
check[i] = max + 1;
return max + 1;
}
}
else
return check[i];
}
}
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 264 | Accepted: 85 |
Description
给出空间上两个运动的小球,球心坐标在分别是A(xa , ya , 0),B(xb , yb , 0),半径分别为Ra , Rb,速度分别为Va( vax, vay , 0), Vb( vbx , vby, 0)。判断两个小球是否会碰撞,若会碰撞, 输出首次碰撞时的时刻和两个小球的坐标;若不会碰撞,输出“Impossible”(球心和速度的z坐标恒为0,可将本题视为只是平面上的运动。初始时刻为0,若初始时刻小球贴在一起,视为首次碰撞)。
Input
Output
Sample Input
3 100 200 0 0 55 100 100 0 0 45 131 123 45 2 43 454 230 0 -5 35 100 100 1 1 31 200 200 2 2 23
Sample Output
0.000 100.000 200.000 100.000 100.000 6.179 409.053 135.358 454.000 199.105 Impossible
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 239 | Accepted: 3 |
Description
Input
Output
Sample Input
2 ababab
Sample Output 3
import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
String str = cin.next();
int max = 1;
if (n > str.length())
System.out.println("0");
else
{
for (; n < str.length(); n++)
{
for (int i = 0; i < str.length() - n; i++)
{
String tempstr = str.substring(i, i + n);
int temp = check(tempstr, str);
// System.out.println(tempstr+" "+temp);
if (temp > max)
{
max = temp;
}
}
}
System.out.println(max);
}
}
static int check(String sub, String str)
{
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != -1)
{
count++;
idx += sub.length();
}
return count;
}
}
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 46 | Accepted: 15 |
Description
现在桌面上有一张矩形纸,上边有n×m个格子,每个格子有一个数字。 每张矩形纸可以算出一个数值F,F是由纸张里任意两个不同的格子里的数字相乘之和。如果该纸只有一个格子,那么F=0。
剪纸规则是: 1、沿格子边缘一直剪成两个矩形纸,每张纸里必须有数字。 2、每次剪纸在桌面上任意选一张矩形纸,进行1操作,再把剪出来的两张纸放到桌面。
现在你可以对桌面上的纸最多剪k次,问最后桌面上所有矩形纸的F值之和最小是多少?
1 ≤ n ≤ 10 1 ≤ m ≤ 10 1 ≤ k ≤ 50Input
Output
Sample Input
Sample Input #1 | Sample Input #2 |
4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 10 10 5 4 2 3 5 6 10 1 6 5 8 3 6 9 1 7 10 7 10 8 1 7 8 3 3 2 5 9 9 8 2 5 5 9 9 3 10 2 9 10 2 1 1 6 7 6 8 3 9 6 8 7 1 2 5 3 2 3 7 8 10 10 9 8 9 7 8 10 7 3 9 6 3 6 2 1 7 10 6 7 2 2 4 8 4 5 9 10 5 9 10 7 4 3 2 4 9 9 9 8 1 |
Sample Output
Sample Output #1 | Sample Output #2 |
18 | 26612 |
Hint
Sample 1说明: 按照下面方式剪纸4次
1 1 1 1
-------------
1 | 1 | 1 | 1
| | |
1 | 1 | 1 | 1
| | |
1 | 1 | 1 | 1
得到6+3+3+3+3=18