填空题
高斯日记

正确答案:
1799-7-16
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int months[13] = {
0,31,0,31,30,31,30,31,31,30,31,30,31};
bool check(int x)
{
if((x%4 == 0 && x%100) || x%400 == 0) return true;
return false;
}
int main()
{
int tot = 8113, cnt = 0;
int year = 1777, m = 4, d = 30;
while(cnt != tot)
{
if(check(year)) months[2] = 29;
else months[2] = 28;
for(int i = m; i <= 12; i++,m++)
{
for(int j = d; j <= months[i]; j++,d++)
{
cnt++;
if(j== months[i]) d = 0;
if(cnt == tot) break;
}
if(i == 12) m = 0;
if(cnt == tot) break;
}
if(cnt != tot) year++;
}
printf("%d-%d-%d\n",year,m,d);
return 0;
}
排它平方数

正确答案:
639172
#include <iostream>
#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
set<int> work(ll x)
{
set<int>c;
while(x)
{
c.insert(x%10);
x /= 10;
}
return c;
}
int main()
{
set<int> a, b;
vector<int>v;
for(int i =100000; i <= 999999; i++)
{
a.clear(); b.clear();
int t = i;
a = work(t);
if(a.size() != 6) continue;
ll ans = i;
ans = ans*ans;
b = work(ans);
int ok = 1;
for(set<int>::iterator it = b.begin(); it != b.end(); it++)
if(a.find(*it) != a.end()) ok = 0;
if(ok) v.push_back(i);
}
for(auto s : v) cout<<s<<'\n';
return 0;
}
振兴中华

正确答案:
35
#include <algorithm>
using namespace std;
typedef long long ll;
int dp[6][6];
int main()
{
dp[1][1] = 1;
for(int i = 1; i <= 4; i++)
for(int j = 1; j <= 5; j++)
dp[i][j] += dp[i-1][j]+dp[i][j-1];
cout<<dp[4][5]<<endl;
return 0;
}
颠倒的价值

正确答案:
9088
#include <iostream>
#include <cstdio>
#include <string>
#include <set>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
unordered_map<int,int>mp;
struct node{
int ago, now;
};
void init()
{
for(int i = 0; i < 10; i++)
{
if(i == 6) mp[6] = 9;
else if(i == 9) mp[9] = 6;
else mp[i] = i;
}
}
int main()
{
init();
vector<node> a, b;
for(int i = 1000; i <= 9999; i++)
{
int t = i;
string temp = "";
while(t)
{
temp += (char)(mp[t%10] + '0');
t /= 10;
}
if(temp[0] == '0') continue;
int y =

最低0.47元/天 解锁文章
1494

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



