求1293中文意思
一直看不懂什么意思.麻烦了 跟编程有关的?帮你顶下啦,不懂的. In this age of Internet, on-line connections, instantaneous email, etc., there are still some people who need to work with floppy disks. John is one of those. Every evening he goes home and continues what he has been doing in his office on his private UNIX system. He copies all the files he needs to floppy disks according to the following procedure:
1. Put all files in one big SHAR file.
2. Compress the file.
3. Uuencode it, such that it is split in nice lines of 62 characters each (including the new-line).
4. Split it in files of 30,000 lines each (about 1.86Mb).
5. Compress each of the files and put it on a floppy by itself.
So far, this procedure always worked, since 1.86Mb of uuencoded text, after compression, will nicely fit on a 1.44Mb floppy disk.
Now, given that through compression the size of the SHAR file halves and that uuencoding a compressed file adds 50% to its size (each rounded to the nearest integer number of bytes), we would like to know for a given size of the SHAR file how many floppies John needs.
Input Specification
The input contains several test cases. Each test case consists of a single line containing one integer s (0 <= s <= 1,000,000,000), specifying the size of the SHAR file in bytes.
The file ends with a file having s = 0. Do not generate output for this file.
Output Specification
For each test case, first output the number of the test case (\'File #1\', \'File #2\', etc.), followed by a line that contains the minimal number of floppies needed for the transfer and a blank line. Adhere to the format shown below in the sample output.
Sample Input
1000000
10000000
100000000
0
Sample Output
File #1
John needs 1 floppies.
File #2
John needs 5 floppies.
File #3
John needs 41 floppies. Floopies
每天晚上john回家继续在他的UNIX系统上工作,他要用磁盘把文件装回家
1.把所有文件打包成一个SHAR文件
2.压缩这个SHAR文件
3.把二进制文件转换成文本文件,每行有62个字符(包括回车)
4.把转换后的文件分割成小份,每30,000行一份 (大约1.86M)
5.再压缩小文件,放进3.5软盘(floopy)里
这方法一定能行,因为1.86M的文件压缩后刚好能放进1.44M的软盘里
已知:
SHAR压缩后将会变成原大小的一半,
把二进制文件转换成文本会增加50%体积,
(计算后的结果四舍5入为整数)
我们需要知道john需要多少张软盘 注意四舍5入就应该可以了
好像不太难
考完试再写啦 #include <stdio.h>
int main()
{
const long flpSize=62*30000;
long shar;
int count=1;
while(scanf(\"%ld\",&shar),shar!=0){
if(shar%2==0)shar/=2;
else {
shar/=2;
shar++;
}
if(shar%2==0)shar+=(shar/2);
else {
shar+=(shar/2);
shar++;
}
int floopy=0;
while(shar>0){
shar-=flpSize;
floopy++;
}
printf(\"File #%d\\n\",count);
printf(\"John needs %d floppies.\\n\\n\",floopy);
count++;
}
} #include<stdio.h>
#include<string.h>
int main()
{
int i,j,k,n;
double c;
k=0;
i=30000*62;
while(scanf(\"%d\",&n),n)
{
k++;
printf(\"File #%d\\n\",k);
c=n*0.75;
if(c==0) c=1;
j=c/i;
if(c>j*i) j++;
printf(\"John needs %d floppies.\\n\\n\",j);
}
return 0;
}
比你强的代码 http://acm.zju.edu.cn/show_problem.php?pid=1275
顺便翻译多一题罗 #include<stdio.h>
int main()
{int n,num=1;
float t;
t=1.0*3/4/1860000;
while(scanf(\"%d\",&n),n!=0)
{ n=n*t;
printf(\"File #%d\\nJohn needs %d floppies.\\n\\n\",num++,n+1);
}
return 0;
} 但是他的代码有点问题的 AC只是说明能通过测试数据啦
测试数据不一定全面的 我都不知道
页:
[1]