1
有些人很迷信数字,比如带“4”的数字,认为和“死”谐音,就觉得不吉利。
虽然这些说法纯属无稽之谈,但有时还要迎合大众的需求。某抽奖活动的奖券号码是5位数(10-99),要求其中不要出现带“4”的号码,主办单位请你计算一下,如果任何两张奖券不重号,最多可发出奖券多少张。
请提交该数字(一个整数),不要写任何多余的内容或说明性文字。
答案:第一位不取0和4,剩下四位不取4, 8*9*9*9*9
2
星系炸弹
在X星系的广袤空间中漂浮着许多X星人造“炸弹”,用来作为宇宙中的路标。
每个炸弹都可以设定多少天之后爆炸。
比如:阿尔法炸弹2015年1月1日放置,定时为15天,则它在2015年1月16日爆炸。
有一个贝塔炸弹,2014年11月9日放置,定时为1000天,请你计算它爆炸的准确日期。
请填写该日期,格式为 yyyy-mm-dd即4位年份2位月份2位日期。比如:2015-02-19
请严格按照格式书写。不能出现其它文字或符号。
答案:2017-08-05
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <climits>
#include <cmath>
#include <cctype>
const int inf = 0x3f3f3f3f;//1061109567
typedef long long ll;
using namespace std;
int mon[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
bool isleap(int year)
{
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
return true;
return false;
}
int main()
{
int year = 2014;
int month,day;
int sum = 1000 - 52;//到这一年年底的时候剩余的时间
int sum1;
while(true)
{
if(isleap(year+1))
{
sum1 = 366;
}
else
{
sum1 = 365;
}
if(sum < sum1)
{
year++;
break;
}
else
{
year++;
sum -= sum1;
}
}
if(isleap(year))
{
mon[2]++;
}
for(int i=1; i<=12; i++)
{
if(sum > mon[i])
{
sum -= mon[i];
}
else
{
month = i;
break;
}
}
day = sum;
printf("%d %d %d\n",year,month,day);
return 0;
}
3
三羊献瑞
观察下面的加法算式:
祥瑞生辉
+ 三羊献瑞
-
三羊生瑞气
(如果有对齐问题,可以参看【图