271 条题解
-
0wangyicheng LV 8 @ 2009-08-08 11:28:45
7 行过 唯美
var
i,k,n,m:longint; j:real;
begin
read(k);n:=1; j:=0;
while j -
02009-08-06 19:43:09@
农夫山泉
-
02009-08-04 18:26:21@
var
k,i :longint;
s :real;
begin
readln(k);
i:=0;
repeat
inc(i);
s:=s+1/i;
until s>k;
writeln(i);
end. -
02009-07-26 19:09:35@
无语,太简单了
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar n,k:longint;
rs:double;begin
read(k);
rs:=0;
for n:=1 to maxlongint do
begin
rs:=rs+1/n;
if rs>k then break;
end;
write(n);
end. -
02009-07-24 15:46:25@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msprogram p1127(input,output);
var n,k:longint;
zs:real;
begin
readln(k);
zs:=0;
n:=0;
while zs -
02009-07-23 19:40:41@
#include
using namespace std;
int main ()
{
long long a[16]={0,2,4,11,31,83,227,616,1674,4550,12367,33617,91380,248397,675214,1835421};
int k;
cin>>k;
cout -
02009-07-20 10:23:41@
var n,i,o:longint;k:real;
begin
read(n);i:=1;
repeat
k:=k+1/i;
i:=i+1;
o:=o+1;
until k>n;
write(o);
end. -
02009-07-16 17:15:11@
var
k,n:longint;
c:extended;
begin
readln(k);
while c -
02009-07-16 15:05:42@
program dsa;
var k:integer;
s,n:real;
begin
read(k);
n:=1;
s:=1;
while s -
02009-07-13 20:59:42@
var k, n, sn : real;
a:longint;
begin
readln(k);
sn:=0;
for a:= 1 to 1000000 do
begin
sn:=sn+1/a;
if sn >k then
begin
writeln(a);
halt;
end;
end;
end. -
02009-07-13 15:11:51@
囧,被longint搞的wa了好几次,AC率暴降
-
02009-07-11 15:28:08@
program ji(input,output);
var k,n:longint;
sum:real;
begin
read(k);
sum:=0;
n:=1;
repeat
sum:=sum+1/n;
n:=n+1;
until sum>k;
write(n-1);
end. -
02009-07-05 00:24:57@
var
s:real;
i,n,k:integer;
begin
readln(k); n:=1;
n:=k;
repeat
s:=0;
for i:=1 to n do
s:=s+1/i;
if s>k then
writeln(n);
inc(n);
until s>k;
end. -
02009-07-03 22:41:17@
#include
using namespace std;
int main()
{
int k,i=0;cin>>k;
double sum=0;
while(sum -
02009-07-01 20:50:13@
#include
int main()
{
long n,k;
double sum=1.0;
scanf("%ld",&k);
for(n=2;;n++)
{
sum+=1.0/(double)n;
if(sum>=(double)k){printf("%ld",n);break;}
}
}
MS全部都得用long/double,还有强制类型转换
我这个程序好像很诡异,死循环,哈哈 -
02009-06-14 20:19:56@
program s2;
var k,n:longint;
sn,i:real;
begin
sn:=0;
n:=0;
readln(k);
while sn -
02009-06-13 20:15:25@
wa*3......我的ac率.....555555555.....
第一次直接写了1/n,实际上n是长整,1/n=0.....改成1./n
第二次60分,float满足不了10以后的k值,遂改成double
第三次最可悲,居然顺手打上了getche();.....全部超时...
附正确答案:
#include
#include
main()
{
double sn=0;
int k;
long n=1;
scanf("%d",&k);
while(sn -
02009-05-26 16:31:17@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msvar
s:real;
i,n,k:integer;
begin
readln(k); n:=1;
n:=k;
repeat
s:=0;
for i:=1 to n do
s:=s+1/i;
if s>k then
writeln(n);
inc(n);
until s>k;
end. -
02009-05-15 15:13:02@
program jishu;
var
i,n:longint;
k,a,j,s:real;
begin
read(k);
a:=0;
i:=0;
while a -
02009-05-05 17:58:42@
var sn:real;n,k:longint;
begin
read(k);
sn:=0;
n:=1;
repeat
sn:=sn+1/n;
n:=n+1;
until sn>k;
write(n-1);
end.