转载请注明出处:優 YoU http://user.qzone.qq.com/289065406/blog/1309071598
打发时间顺手A的水题= = 没啥好说的。。。
算是增强一下做难题前的信心O(∩_∩)O
1
//
Memory Time
2
//
260K 0MS
3
4
#include
<
iostream
>
5
using
namespace
std;
6
7
int
main(
void
)
8
{
9
const
int
size
=
301
;
//
最大长度5.20要用276张卡片
10
double
length[size]
=
{
0.0
};
//
i张卡片的延伸长度为length[i]
11
//
服务器打表,把计算过的值保存,节省时间
12
double
len;
13
while
(cin
>>
len
&&
len)
14
{
15
int
i;
16
for
(i
=
1
;i
<
size;i
++
)
17
{
18
if
(
!
length[i])
19
length[i]
=
length[i
-
1
]
+
1.0
/
(i
+
1.0
);
20
21
if
(length[i]
>=
len)
22
break
;
23
}
24
cout
<<
i
<<
"
card(s)
"
<<
endl;
25
}
26
return
0
;
27
}

