水。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const char sx[20][12] = {"Rabbit", "Tiger", "Ox", "Rat", "Pig", "Dog", "Rooster", "Monkey", "Ram", "Horse", "Snake", "Dragon" };
int main()
{
int T;
scanf("%d", &T);
while(T--)
{
int k;
scanf("%d", &k);
printf("%s\n", sx[(k - 1) % 12]);
}
}
本文深入解析ZOJ3479 Chinese Zodiac编程题目的解题思路,通过C++代码实现,巧妙运用模运算解决生肖问题,适合编程初学者学习。
818

被折叠的 条评论
为什么被折叠?



