lqylqylqy @ 2016-04-19 22:32:36
@kkksc03这题没有一个人通过, ( 全部显示too many or too few lines (怀疑是数据多了空行或者比较方式不对) ) 而大家的写法都是对的,USACO上能通过的都过不了,请核对一下数据是否有问题,谢谢。
by kkksc03 @ 2016-04-19 23:32:23
@lqylqylqy 数据的确弄错了。现在已经更正。请再次提交。
by lqylqylqy @ 2016-04-20 12:33:33
@kkksc03请再看一下USACO的其他题有没有弄错,比如p2723
by 超能坦克RPG @ 2016-04-20 20:04:24
怪不得我刷了好几遍,数据全对,却全是WA
by 超能坦克RPG @ 2016-04-20 20:14:54
2723没问题,AC代码:
#include <stdio.h>
#include <string.h>
#define MAX 100
#define getint(i) scanf("%d", &i)
#define insert(i) hum[count++] = i
long hum[1000001];
int pindex[MAX];
int prime[MAX];
int count;
int main(void)
{
int k, n;
int i;
int min, m;
getint(k);
getint(n);
for(i = 0; i < k; i++){
getint(prime[i]);
}
insert(1);
memset(pindex, 0, sizeof(int)*k);
while(count <= n){
min = 0x7FFFFFFF;
for(i = 0; i < k; i++){
while(prime[i] * hum[pindex[i]] <= hum[count - 1]){
pindex[i]++;
}
if(prime[i] * hum[pindex[i]] < min){
min = prime[i] * hum[pindex[i]];
m = i;
}
}
insert(min);
}
printf("%d\n", hum[n]);
return 0;
}
by huihao @ 2017-03-11 22:30:08
数组开大点