• 奋斗的小蜗牛


    奋斗的小蜗牛

    时间限制:1000 ms  |  内存限制:65535 KB
    难度:1
     
    描述
    传说中能站在金字塔顶的只有两种动物,一种是鹰,一种是蜗牛。一只小蜗牛听了这个传说后,大受鼓舞,立志要爬上金字塔。为了实现自己的梦想,蜗牛找到了老鹰,老鹰告诉它金字塔高H米,小蜗牛知道一个白天自己能向上爬10米,但由于晚上要休息,自己会下滑5米。它想知道自己在第几天能站在金字塔顶,它想让你帮他写个程序帮助它。
     
    输入
    第一行有一个整数t,表示t组测试数据。
    第二行一个整数H(0<H<10^9)代表金字塔的高度。
    输出
    输出一个整数n表示小蜗牛第n天站在金字塔顶上
    样例输入
    2
    1
    5
    样例输出
    1
    1
    上传者

    ACM_王孝锋


     

    01.#include<stdio.h>
    02.int main()
    03.{
    04.int T;
    05.scanf("%d",&T);
    06.while(T--)
    07.{
    08.int h,day=0;
    09.scanf("%d",&h);
    10.if(h<=10)
    11.printf("1 ");
    12.else if(h%5==0)
    13.{
    14.printf("%d ",(h/5)-1);
    15.}
    16.else
    17.printf("%d ",(h/5));
    18.}
    19.return 0;
    20.}
  • 相关阅读:
    Codeforces Round #358 (Div. 2)
    Codeforces Round #357 (Div. 2)
    Codeforces Round #356 (Div. 2)
    第11章例题(紫书)
    第10章例题(紫书)
    Codeforces Round #354 (Div. 2)
    2016百度之星
    BestCoder 1st Anniversary
    BestCoder Round #41
    BestCoder Round #40
  • 原文地址:https://www.cnblogs.com/leishitou/p/5436218.html
Copyright © 2020-2023  润新知