PAT 天梯赛 L1-033. 出生年 【水】
题目链接
https://www.patest.cn/contests/gplt/L1-033
AC代码
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
int f(int y)
{
map <int, int> m;
m.clear();
if (y < 1000)
m[0] = 1;
while (y)
{
m[y % 10] = 1;
y /= 10;
}
return m.size();
}
int main()
{
int y, n;
cin >> y >> n;
int ans = 0;
while (1)
{
if (f(y) == n)
break;
y++;
ans++;
}
printf("%d %04d\n", ans, y);
}
PAT 天梯赛 L1-033. 出生年 【水】的更多相关文章
- PAT 天梯赛 L1-047. 装睡 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-047 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-042. 日期格式化 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-042 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-041. 寻找250 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-041 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-022. 奇偶分家 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-022 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-016. 查验身份证 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-016 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-014. 简单题 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-014 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-012. 计算指数 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-012 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-010. 比较大小 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-010 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-007. 念数字 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-007 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-004. 计算摄氏温度 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-004 AC代码 #include <iostream> #include <cstdio&g ...
随机推荐
- 设计模式中类的关系之聚合关系(Aggregation)
聚合关系是关联关系的一种特例,它体现的是整体与部分的关系,即has-a的关系,此时整体与部分之间是可分离的,它们可以具有各自的生命周期,部分可以属于多个整体对象,也可以为多个整体对象共享.比如计算机与 ...
- deque双端队列用法
#include <iostream> #include <cstdio> #include <deque> #include <algorithm> ...
- 【LeetCode】 Rotate List 循环链表
题目:rotate list 解法1: <span style="font-size:18px;">/**LeetCode Rotate List:Given a li ...
- 浅谈web前端安全
单纯地在你的客户端弹出信息只是类似于迫使你在自己的房间脱衣服--没人看得到,自然也不算啥恶意行为.那么如果我把你的信息通过脚本发送到我的服务器保存起来呢?先放心,我不打算这么做,也没那笔闲钱去购置一个 ...
- Vsphere日记01.ESXi5.5.install
Vsphere ESXi 5.5 install ESXI 5.5 安装环境需求 1.CPU需求 1.1)Interl CPU 必须支持VT-X技术,且在BIOS中开启.I 系列CPU.exon 系列 ...
- CodeAreaFX
CodeAreaFX is a text area for JavaFX with API to style ranges of text. It is intended as a base for ...
- php 远程调用redis
<?php $redis_conf = array ( "active_code"=>array( "host" => "14.29 ...
- Android中*_handle_t/ANativeWindowBuffer/ANativeWindow/GraphicBuffer/Surface的关系
在阅读SurfaceFlinger HardwareComposer以及gralloc相关代码的过程中,我们经常会遇到native_handle private_handle_t ANativeWin ...
- Beamer加中文
\documentclass{beamer} \mode<presentation> { \usetheme{CambridgeUS} % or try Darmstadt, Madrid ...
- Redis快速入门及实现
redis的概念 (1)Redis的优点 以下是Redis的一些优点. 异常快 - Redis非常快,每秒可执行大约110000次的设置(SET)操作,每秒大约可执行81000次的读取/获取(GET) ...