不科学,同样的程序,只是变量名不同,结果不同

P1021Victoria的舞会1

记录信息
评测状态 Wrong Answer

题目 P1021 Victoria的舞会1

递交时间 2015-08-09 22:11:45
代码语言 C++
评测机 VijosEx
消耗时间 44 ms
消耗内存 520 KiB
评测时间 2015-08-09 22:11:46
评测结果
编译成功
测试数据 #0: WrongAnswer, time = 0 ms, mem = 516 KiB, score = 0
测试数据 #1: Accepted, time = 12 ms, mem = 516 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 516 KiB, score = 10
测试数据 #3: WrongAnswer, time = 0 ms, mem = 520 KiB, score = 0
测试数据 #4: Accepted, time = 0 ms, mem = 516 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 516 KiB, score = 10
测试数据 #6: WrongAnswer, time = 15 ms, mem = 516 KiB, score = 0
测试数据 #7: Accepted, time = 0 ms, mem = 516 KiB, score = 10
测试数据 #8: WrongAnswer, time = 0 ms, mem = 512 KiB, score = 0
测试数据 #9: WrongAnswer, time = 2 ms, mem = 516 KiB, score = 0
WrongAnswer, time = 44 ms, mem = 520 KiB, score = 50
代码
#include<iostream>
using namespace std;
int main()
{

int n,k,i,t1,m=0,t;
cin>>n>>k;
for(i=1;i<=n;i++);
{

t=0;
while(1)
{
cin>>t1;
if(t1!=0)
t+=1;
else
break;
}
if(t>=k)
m+=1;
}
cout<<m;
}

P1021Victoria的舞会1

记录信息
评测状态 Accepted

题目 P1021 Victoria的舞会1

递交时间 2015-08-09 22:11:09
代码语言 C++
评测机 VijosEx
消耗时间 112 ms
消耗内存 520 KiB
评测时间 2015-08-09 22:11:10
评测结果
编译成功
测试数据 #0: Accepted, time = 15 ms, mem = 520 KiB, score = 10
测试数据 #1: Accepted, time = 15 ms, mem = 520 KiB, score = 10
测试数据 #2: Accepted, time = 3 ms, mem = 516 KiB, score = 10
测试数据 #3: Accepted, time = 2 ms, mem = 516 KiB, score = 10
测试数据 #4: Accepted, time = 2 ms, mem = 516 KiB, score = 10
测试数据 #5: Accepted, time = 1 ms, mem = 512 KiB, score = 10
测试数据 #6: Accepted, time = 2 ms, mem = 516 KiB, score = 10
测试数据 #7: Accepted, time = 1 ms, mem = 512 KiB, score = 10
测试数据 #8: Accepted, time = 56 ms, mem = 516 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 512 KiB, score = 10
Accepted, time = 112 ms, mem = 520 KiB, score = 100
代码
#include<iostream>
using namespace std;
int main ()
{
int n,k,i,a,sum=0,now;
cin>>n>>k;
for(i=1;i<=n;i++)
{
now=0;
while(1)
{
cin>>a;
if(a!=0)
now+=1;
else
break;
}
if(now>=k)
sum+=1;
}
cout<<sum;
}

1 条评论

  • @ 2015-08-10 00:26:28

    第一个程序中
    for(i=1;i<=n;i++);
    应改成for(i=1;i<=n;i++)

  • 1

信息

ID
1021
难度
3
分类
贪心 点击显示
标签
递交数
6432
已通过
3225
通过率
50%
被复制
24
上传者