zoukankan      html  css  js  c++  java
  • ZOJ 3594 年份水题 【注意:没有0年】

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<stdio.h>
    #include<string.h>
    using namespace std;
    int main(){
        char a[10][6] = {"Jia", "Yi", "Bing", "Ding", "Wu", "Ji", "Geng", "Xin", "Ren" , "Gui"};
        char b[12][6] = {"zi", "chou", "yin", "mao", "chen", "si", "wu", "wei", "shen", "you", "xu" , "hai"};
        int i,j,flag_a,flag_b,t,num,sample_Value;
        scanf("%d",&t);
        sample_Value = 1911;
        while(t--){
            flag_a = 7;
            flag_b = 11;
            scanf("%d",&num);
    
            if(num < 0) num++;
    
            if(num >= sample_Value){
                num -= sample_Value;
                flag_a = (flag_a + num) % 10;
                flag_b = (flag_b + num) % 12;
                printf("%s%s
    ",a[flag_a],b[flag_b]);
            }
            else{
                int temp = sample_Value - num;
                while(temp--){
                    flag_a --;
                    if(flag_a < 0){
                        flag_a +=10;
                        flag_a %= 10;
                    }
                    flag_b--;
                    if(flag_b < 0){
                        flag_b += 12;
                        flag_b %= 12;
                    }
                }
                printf("%s%s
    ",a[flag_a],b[flag_b]);
            }
        }
        return 0;
    }
  • 相关阅读:
    H5 WebSocket
    JS call()、apply()、bind()
    JS中this指向问题
    JS GET POST请求
    php 常用get post http请求
    php 开启redis
    egret接入华为快应用6004
    PHP生成公私钥,签名和验签
    JS数组去重
    Oracle第九课
  • 原文地址:https://www.cnblogs.com/wushuaiyi/p/3655035.html
Copyright © 2011-2022 走看看