zoukankan      html  css  js  c++  java
  • 星际密码

    题目:https://www.nowcoder.com/pat/2/problem/254

     1 #include <iostream>
     2 #include <algorithm>
     3 #include <stdio.h>
     4 using namespace std;
     5 const int maxn = 105;
     6 int f[10005];
     7 int x[maxn];
     8 
     9 void db(){
    10     int a, b, c, d;
    11     int a1, b1, c1, d1;
    12     a = b = c = 1;
    13     d = 0;
    14     f[0] = 1;
    15     f[1] = 1;
    16     for (int i = 2; i < 10005; i++){
    17         f[i] = (f[i - 1] + f[i - 2]) % 10000;
    18     }
    19 
    20 }
    21 
    22 int main(){
    23 //    std::ios::sync_with_stdio(false);
    24     int n;
    25     db();
    26     while (~scanf("%d",&n))
    27     {
    28         for (int i = 0; i < n; i++){
    29             scanf("%d", &x[i]);
    30         }
    31         for (int i = 0; i < n; i++){
    32             printf("%04d", f[x[i]]);
    33         }
    34         printf("
    ");
    35     }
    36     //system("pause");
    37     return 0;
    38 }
  • 相关阅读:
    GDOI模拟赛Round 1
    Codeforces 241B
    Codeforces 325E
    Codeforces 235E
    Codeforces 293B
    Codeforces 263E
    快速傅里叶变换FFT
    后缀自动机
    NOI2011 Day2
    NOI2014 Day2
  • 原文地址:https://www.cnblogs.com/ouyang_wsgwz/p/8214083.html
Copyright © 2011-2022 走看看