工大后院

 找回密码
 加入后院

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
查看: 1364|回复: 11

求1293中文意思

[复制链接]
发表于 2005-6-22 12:36 | 显示全部楼层 |阅读模式
一直看不懂什么意思.麻烦了
发表于 2005-6-22 12:59 | 显示全部楼层
跟编程有关的?
帮你顶下啦,不懂的.
回复

使用道具 举报

 楼主| 发表于 2005-6-22 13:03 | 显示全部楼层
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.
回复

使用道具 举报

发表于 2005-6-22 13:23 | 显示全部楼层
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需要多少张软盘
回复

使用道具 举报

发表于 2005-6-22 13:24 | 显示全部楼层
注意四舍5入就应该可以了

好像不太难

考完试再写啦
回复

使用道具 举报

发表于 2005-6-22 13:29 | 显示全部楼层
#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++;
        }
}
回复

使用道具 举报

 楼主| 发表于 2005-6-22 13:45 | 显示全部楼层
#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;
}
比你强的代码
回复

使用道具 举报

 楼主| 发表于 2005-6-22 13:46 | 显示全部楼层
回复

使用道具 举报

发表于 2005-6-22 13:49 | 显示全部楼层
#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;
}
回复

使用道具 举报

 楼主| 发表于 2005-6-22 14:50 | 显示全部楼层
但是他的代码有点问题的
回复

使用道具 举报

发表于 2005-6-22 18:08 | 显示全部楼层
AC只是说明能通过测试数据啦

测试数据不一定全面的
回复

使用道具 举报

发表于 2005-6-25 11:46 | 显示全部楼层
我都不知道
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入后院

本版积分规则

QQ|Archiver|手机版|小黑屋|广告业务Q|工大后院 ( 粤ICP备10013660号 )

GMT+8, 2024-6-4 17:13

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表