zoukankan      html  css  js  c++  java
  • Snail’s trouble

    Snail’s trouble

    Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 74 Accepted Submission(s): 51
     
    Problem Description
    Once upon a time, there was a poor snail. Every day, it tried very hard to crawl forward, while there was a keeper who’d like to maltreat this poor little snail. The snail was crawling on a one-meter rubber band at first, and it can move on k cm every minute. But after that, the keeper stretches the rubber band quickly, and it would be elongated one meter, during that the distances ratio between the snail and the two endpoints remain unchanged. In the next minute, little snail tried to keep moving forward again.
    “Can I finally get to the endpoint?”
    The snail often asked himself such a question because he was afraid he would never succeed. Now, we hope you can tell this poor snail when he would reach the endpoint.
     
    Input
    Every line of the input contains an integer number k, indicating that the snail moved forward k cm every minute. (5 <= k <= 100)
     
    Output
    Output an integer t, indicating that the snail doesn’t get to the endpoint until t-1 minutes later, while t minutes later, it finally succeed.
     
    Sample Input
    10
    100
     
    Sample Output
    12367
    1
     
     
    Source
    2009 Multi-University Training Contest 2 - Host by TJU
     
    Recommend
    gaojie
     
    /*
    题意:一个蜗牛初始的时候在一块长1米的橡胶上,速度为一分钟k厘米,在每分钟的末尾橡胶会很快的
        拉长一米,但是蜗牛在橡胶上的比例位置不变。蜗牛第一次到达末尾的时间是多少
        
    初步思路:简单的模拟嘛,但是很好时间,所以就打表
    */
    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int a[100]={272400600,9717617,898515,150661,37568,12367,4983,2336,1230,710,441,291,201,145,108,83,66,53,43,36,31,26,23,20,18,16,14,13,12,11,10,9,8,8,7,7,6,6,6,5,5,5,5,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1};
    int main(){
        // freopen("in.txt","r",stdin);
        // for(int n=5;n<=100;n++){
            // int t=0;
            // double sum=100;
            // double w=0;
            // while(true){
                // t++;
                // w+=n;//蜗牛走的
                // if(w>=sum){
                    // cout<<t<<",";
                    // break;
                // }
                // double tmp=sum+100;
                // w=tmp*w*1.0/sum;
                // sum=tmp;
            // }
        // }
        while(scanf("%d",&n)!=EOF){
            printf("%d
    ",a[n-5]);
        }
        return 0;
    }
  • 相关阅读:
    ocos 信号量
    C 语言 输入字符串 并计算输入的字符的长度
    C 语言简历一个文件夹 并自己输入字符 来取文件夹名字
    C语言 创建一个 txt 文件 bin输入字符 保存文件在工作文件夹里
    C语言 之 printf () 函数你真的会用吗?
    Impala的命令COMPUTE STATS
    python 函数eval
    YouTube排名第一的励志英文演讲《Dream(梦想)》
    impala 表迁移方式 partquet数据文件移动方法
    Python中@staticmethod和@classmethod的作用和区别
  • 原文地址:https://www.cnblogs.com/wuwangchuxin0924/p/6408717.html
Copyright © 2011-2022 走看看