杭电OJ 1036 Average is not Fast Enough!

我没有车没有房2022-10-04 11:39:541条回答

杭电OJ 1036 Average is not Fast Enough!
链接
就是那个输入2 12.5
5 0:23:21 0:25:01
怎么输出5:3:52 min/km

已提交,审核后显示!提交回复

共1条回复
ckss2000 共回答了26个问题 | 采纳率92.3%
一共2圈, 每圈12.5公里
5号选手第一圈用了23分21秒,第二圈用了25分1秒
输出5号选手每千米平均花费时间3分52秒
1年前

相关推荐

杭电 1020 无法AC Problem DescriptionGiven a string containing on
杭电 1020 无法AC
Problem Description
Given a string containing only 'A' - 'Z',we could encode it using the following method:
1.Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character in this sub-string.
2.If the length of the sub-string is 1,'1' should be ignored.
Input
The first line contains an integer N (1 n;
x05while(n--)
x05{
x05x05t=0;
x05x05t1=0;
x05x05i=0;
x05x05gets(a);
x05x05while(a[i]!=NULL)
x05x05{
x05x05x05count=1;
x05x05x05while(a[i]==a[i+1])
x05x05x05{
x05x05x05x05count++;
x05x05x05x05i++;
x05x05x05}
x05x05x05
x05x05x05if(count==1)
x05x05x05x05cout
独行在ii1年前1
猫咪520 共回答了24个问题 | 采纳率100%
把 gets(a) 换成 cin >> a;
杭电ACM 1019Problem DescriptionThe least common multiple (LCM)
杭电acm 1019
problem description
the least common multiple (lcm) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set.for example,the lcm of 5,7 and 15 is 105.
input
input will consist of multiple problem instances.the first line of the input will contain a single integer indicating the number of problem instances.each instance will consist of a single line of the form m n1 n2 n3 ...nm where m is the number of integers in the set and n1 ...nm are the integers.all integers will be positive and lie within the range of a 32-bit integer.
output
for each problem instance,output a single line containing the corresponding lcm.all results will lie in the range of a 32-bit integer.
sample input
2
3 5 7 15
6 4 10296 936 1287 792 1
sample output
105
10296
#include
#include
#include
int ***(int a,int b)
{
x05int t=0;
x05if(a
lin74741年前1
追忆哈哈 共回答了22个问题 | 采纳率86.4%
首先max=b[0]应该加一个条件,就是说要在k=0的时候才行,否则的话,每次都要对他赋值,这个是没有必要的.(if(k==0) max=b[0];)
其次,你的算法有问题,最小公倍数不是两个数相乘就行了,而是能被两者除尽的最小的那个数.
代码如下:
我修改了你和回答人的代码,并且已经A了

#include "stdio.h"
long int LCM(int a,int b)//求最小公倍数的函数
{
long int x;
if (a>b)
{
x=a;
while (x%b!=0)
{ //小优化,既然x是a和b的最小公倍数,所以枚举时只要一直加a或b,再判断能否整除另一个数
x+=a;
}
return x;

}
else
{
x=b;
while (x%a!=0)
{
x+=b;
}
return x;
}
}
int main()
{
int m,n,i,j,k;
long int max,a[100],b[100];
scanf("%dn",&m);
for(i=0;i {
scanf("%d",&n);
for(j=0;j scanf("%d",&a[j]);
for(k=1;k {
a[k]=LCM(a[k],a[k-1]);//计算相连的两个数的最小公倍数,并替换

}
printf("%ldn",a[k-1]);

}

return 0;
}
杭电 2055 An easy problem
杭电 2055 An easy problem
Problem Description
we define f(A) = 1,f(a) = -1,f(B) = 2,f(b) = -2,...f(Z) = 26,f(z) = -26;
Give you a letter x and a number y ,you should output the result of y+f(x).
Input
On the first line,contains a number T.then T lines follow,each line is a case.each case contains a letter and a number.
Output
for each case,you should the result of y+f(x) on a line.
Sample Input
6
R 1
P 2
G 3
r 1
p 2
g 3
Sample Output
19
18
10
-17
-14
-4
我的代码:这段一直过不了,检查不出错,无奈之下switch了一大串,终于通过了,不过还想求教这段到底哪里有问题,
#include
int main()
{
x05int a,s,i;
x05char z;
while(scanf("%d",&a)!=EOF)
{
x05for(i=0;i='a'&&z='A'&&z
幸福的棒棒糖1年前1
秦蓼 共回答了21个问题 | 采纳率95.2%
这是我的ac码
我觉得可能是你的输入控制有问题吧,没有将换行符去掉
#include
int main()
{
int a,c;
char b;
scanf("%d",&a);
while(a--)
{
getchar();*********去掉换行符,有整数有有字符的时候要注意的.
b=getchar();
scanf("%d",&c);
if(b>='a') printf("%dn",'a'-1-b+c);
else printf("%dn",b-'A'+1+c);
}return 0;
}
杭电ACM1005 Number Sequence
杭电ACM1005 Number Sequence
A number sequence is defined as follows:
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
Given A, B, and n, you are to calculate the value of f(n).

Input
The input consists of multiple test cases. Each test case contains 3 integers A, B and n on a single line (1
爱BOBO13141年前1
clare_wind 共回答了16个问题 | 采纳率93.8%
/*
1 1 3
2
1 2 10
5
0 0 0
Press any key to continue
*/
#include

int main(void) {
x09int a1 = 1,a2 = 1,an;
x09int A,B,n,i;
x09while(1) {
x09x09scanf("%d%d%d",&A,&B,&n);
x09x09if(A == 0 B == 0 n == 0) break;
x09x09a1 = 1;
x09x09a2 = 1;
x09x09for(i = 3; i <= n; ++i) {
x09x09x09an = (A * a2 + B * a1) % 7;
x09x09x09a1 = a2;
x09x09x09a2 = an;
x09x09}
x09x09printf("%dn",an);
x09}
x09return 0;
}
杭电ACM 1005 javaA number sequence is defined as follows:f(1)
杭电ACM 1005 java
A number sequence is defined as follows:
f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
Given A,B,and n,you are to calculate the value of f(n).
The input consists of multiple test cases.Each test case contains 3 integers A,B and n on a single line (1
xwd08201年前1
再不见风烟 共回答了18个问题 | 采纳率72.2%
if (a < 1 && a > 1000 && b < 1 && b > 1000 && b < 1 && a > 100000000)
System.exit(0);
这句你用的是& 不对 还有就是你这个做法不行 BigInteger f[] = new BigInteger[n]; 当n=100000000时开不了这么大的数组 时间复杂度也不行 必定超时
杭电ACM1092题目 Problem Description Your task is to Calculate th
杭电ACM1092题目 Problem Description Your task is to Calculate the sum of some integers.Input Input
#include"stdio.h"
int main()
{
int a,b,n;
a=0;
while(scanf("%d",&n)!=EOF){
while(n--){
scanf("%d",&b);
a=a+b;
}
printf("%dn",a);
}
return 0;
}
错在哪里啊啊,说的基础点的额
多少爱可以重做1年前1
lijuan524 共回答了20个问题 | 采纳率95%
1、你的a=0放的地方不对,你这样的话只有第一次的结果是对的.应该把它放到循环里面
2、题目要求的是N为0时结束,你的代码在N为0时还做了一次输出
3、虽然题目没说整数的范围,但是可能会因为int类型不够,加法会产生溢出
杭电acm Problem DescriptionNow give you two integers n m,you j
杭电acm
Problem Description
Now give you two integers n m,you just tell me the m-th number after radix point in 1/n,for example n=4,the first numble after point is 2,the second is 5,and all 0 followed
Input
Each line of input will contain a pair of integers for n and m(1
xiaoyan1985361年前1
奥诗卡 共回答了15个问题 | 采纳率73.3%
你想的太简单了
给你代码,你去研究一下吧
#include
//除法的基本运算
void x_mod_y( int x, int y, int *shang, int *yushu )
{
*shang=0;
while ( x >= y )
{
*shang += 1 ;
x-=y;
}
*yushu=x ;
}
自己去加循环
int main()
{
int n,m;
int i=0;
int x,shang,yushu;
scanf("%d %d",&n,&m );
x=1;
for( i=0;x&&i
杭电 acm 1019!WR!Problem DescriptionThe least common multiple
杭电 acm 1019!WR!
Problem Description
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set.For example,the LCM of 5,7 and 15 is 105.
Input
Input will consist of multiple problem instances.The first line of the input will contain a single integer indicating the number of problem instances.Each instance will consist of a single line of the form m n1 n2 n3 ...nm where m is the number of integers in the set and n1 ...nm are the integers.All integers will be positive and lie within the range of a 32-bit integer.
Output
For each problem instance,output a single line containing the corresponding LCM.All results will lie in the range of a 32-bit integer.
Sample Input
2
3 5 7 15
6 4 10296 936 1287 792 1
Sample Output
105
10296
代码:
#include
void main()
{
x05long int n,m,i,a[1000],max,s,j,x;
x05while(scanf("%ld",&n)!=EOF)
x05{
x05x05while(n--)
x05x05{
x05x05x05scanf("%ld",&m);
x05x05x05for(i=0;i
Tracy04291年前1
含剑 共回答了29个问题 | 采纳率82.8%
#include
void main()
{
long int n,m,i,a[1000],max,s,j,x;
while(scanf("%ld",&n)!=EOF)
{
while(n--)
{
scanf("%ld",&m);
for(i=0;i