zoukankan      html  css  js  c++  java
  • FOJ有奖月赛-2015年11月 Problem B 函数求解

    Problem B 函数求解

    Accept: 171    Submit: 540
    Time Limit: 1000 mSec    Memory Limit : 32768 KB

     Problem Description

    给出n,求f(n)。

     Input

    第一行一个正整数T,表示数据组数。 接下来T行,每行一个正整数n。 T<=20,n<=2015000000。

     Output

    对于每组数据,输出一行f(n)。

     Sample Input

    2
    1
    20150001

    Sample Output

    2015
    20152014
    题目也是偶然看到的,看了一下,没一下子想懂,感觉问题出在f(f(n-2015)),应该最后是把所求的数逼近20150001;
    题解很简单:n<20150001   n+2014

          n>=20150001     20152014

    代码:

    来源:http://blog.csdn.net/qq1319479809/article/details/49851423

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<algorithm>
     4 #include<cstring>
     5 using namespace std;
     6 int main()
     7 {
     8     int t;
     9     long long n;
    10     scanf("%d",&t);
    11     while(t--)
    12     {
    13         scanf("%lld",&n);
    14         if(n<20150001)
    15         {
    16             printf("%lld
    ",n+2014);
    17         }
    18         else printf("20152014
    ");
    19     }
    20     return 0;
    21 }
  • 相关阅读:
    c8051f交叉开关
    8052定时器2的用法
    poj1010
    poj2101
    poj1958
    poj3444
    poj2977
    DataTable 相关操作
    C#中string和StringBuilder的区别
    DataTable排序,检索,合并,筛选
  • 原文地址:https://www.cnblogs.com/ISGuXing/p/7259660.html
Copyright © 2011-2022 走看看