A - ABCxxx


Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

This contest, AtCoder Beginner Contest, is abbreviated as ABC.

When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.

What is the abbreviation for the N-th round of ABC? Write a program to output the answer.

Constraints

  • 100≤N≤999

Input

Input is given from Standard Input in the following format:

N

Output

Print the abbreviation for the N-th round of ABC.


Sample Input 1

Copy
100

Sample Output 1

Copy
ABC100

The 100th round of ABC is ABC100.


Sample Input 2

Copy
425

Sample Output 2

Copy
ABC425

Sample Input 3

Copy
999

Sample Output 3

Copy
ABC999

题解:水水

 #include <cstdio>
int main()
{
int n;
scanf("%d",&n);
printf("ABC%d\n",n);
return ;
}

B - Break Number


Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

Takahashi loves numbers divisible by 2.

You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.

Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.

For example,

  • 6 can be divided by 2 once: 6 -> 3.
  • 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.
  • 3 can be divided by 2 zero times.

Constraints

  • 1≤N≤100

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.


Sample Input 1

Copy
7

Sample Output 1

Copy
4

4 can be divided by 2 twice, which is the most number of times among 12, ..., 7.


Sample Input 2

Copy
32

Sample Output 2

Copy
32

Sample Input 3

Copy
1

Sample Output 3

Copy
1

Sample Input 4

Copy
100

Sample Output 4

Copy
64

题解:水水
 #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<) cout<<<<endl;
else if(n<) cout<<<<endl;
else if(n<) cout<<<<endl;
else if(n<) cout<<<<endl;
else if(n<) cout<<<<endl;
else if(n<) cout<<<<endl;
else cout<<<<endl;
return ;
}

C - Cat Snuke and a Voyage


Time limit : 2sec / Memory limit : 256MB

Score : 300 points

Problem Statement

In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N.

There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island ai and Island bi.

Cat Snuke is on Island 1 now, and wants to go to Island N. However, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.

Help him.

Constraints

  • 3≤N≤200 000
  • 1≤M≤200 000
  • 1≤ai<biN
  • (ai,bi)≠(1,N)
  • If ij(ai,bi)≠(aj,bj).

Input

Input is given from Standard Input in the following format:

N M
a1 b1
a2 b2
:
aM bM

Output

If it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.


Sample Input 1

Copy
3 2
1 2
2 3

Sample Output 1

Copy
POSSIBLE

Sample Input 2

Copy
4 3
1 2
2 3
3 4

Sample Output 2

Copy
IMPOSSIBLE

You have to use three boat services to get to Island 4.


Sample Input 3

Copy
100000 1
1 99999

Sample Output 3

Copy
IMPOSSIBLE

Sample Input 4

Copy
5 5
1 3
4 5
2 3
2 4
1 4

Sample Output 4

Copy
POSSIBLE

You can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.

题目大意:给出一个有向图,问1->n能否两步到达
解题思路:dfs搜索,或者判断1的下一个结点和n的上一个结点是否有公共的就行了

 #include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL INF=1e18;
const int MAXN=2e5+;
const double eps=1e-;
bool vis[MAXN];
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF){
int u,v;
bool flag=false;
for(int i=;i<=n;i++)
vis[i]=false;
for(int i=;i<=m;i++){
scanf("%d%d",&u,&v);
if(flag) continue;
if(u==){
if(vis[v]){
flag=true;
}
vis[v]=true;
}else if(v==n){
if(vis[u]){
flag=true;
}
vis[u]=true;
}
}
if(flag) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
}
return ;
}
 #include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL INF=1e18;
const int MAXN=2e5+;
const double eps=1e-;
int tot;
int head[MAXN];
int n,m;
struct Edge
{
int from,to,nxt;
}e[MAXN];
void addedge(int u,int v)
{
e[tot].from=u;
e[tot].to=v;
e[tot].nxt=head[u];
head[u]=tot++;
}
bool dfs(int s,int t,int k)
{
if(s==n&&k==) return true;
for(int i=head[s];i!=-;i=e[i].nxt){
int to=e[i].to;
if(dfs(to,n,k+)) return true;
}
return false;
}
int main()
{
int d,k;
while(scanf("%d%d",&n,&m)!=EOF){
memset(head,-,sizeof(head));
int u,v;
for(int i=;i<=m;i++){
scanf("%d%d",&u,&v);
addedge(u,v);
}
if(dfs(,n,))
printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
}
return ;
}

D - Decrease (Contestant ver.)


Time limit : 2sec / Memory limit : 256MB

Score : 600 points

Problem Statement

We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N−1 or smaller.

  • Determine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.

It can be proved that the largest element in the sequence becomes N−1 or smaller after a finite number of operations.

You are given an integer K. Find an integer sequence ai such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.

Constraints

  • 0≤K≤50×1016

Input

Input is given from Standard Input in the following format:

K

Output

Print a solution in the following format:

N
a1 a2 ... aN

Here, 2≤N≤50 and 0≤ai≤1016+1000 must hold.


Sample Input 1

Copy
0

Sample Output 1

Copy
4
3 3 3 3

Sample Input 2

Copy
1

Sample Output 2

Copy
3
1 0 3

Sample Input 3

Copy
2

Sample Output 3

Copy
2
2 2

The operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].


Sample Input 4

Copy
3

Sample Output 4

Copy
7
27 0 0 0 0 0 0

Sample Input 5

Copy
1234567894848

Sample Output 5

Copy
10
1000 193 256 777 0 1 1192 1234567891011 48 425 题解:(构造)从n个t变化到n个t-1,恰好要n步,并且其中每一步的max值都>=t,所以把50个49当成最终局面,从这里开始,根据输入的K计算初始局面即可
此题题解转自:http://www.cnblogs.com/autsky-jadek/
 #include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll K;
int main(){
cin>>K;
int n=;
printf("%d\n",n);
ll a=K/(ll)n; ll b=K%(ll)n;
int cnt=;
for(int i=;i<=(int)b;++i){
++cnt;
cout<<49ll+a+((ll)n-(b-1ll))<<(cnt==n ? '\n' : ' ');
}
for(int i=;i<=n-(int)b;++i){
++cnt;
cout<<49ll+a-b<<(cnt==n ? '\n' : ' ');
}
return ;
}

AtCoder Beginner Contest 068 ABCD题的更多相关文章

  1. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  2. AtCoder Beginner Contest 069 ABCD题

    题目链接:http://abc069.contest.atcoder.jp/assignments A - K-City Time limit : 2sec / Memory limit : 256M ...

  3. AtCoder Beginner Contest 070 ABCD题

    题目链接:http://abc070.contest.atcoder.jp/assignments A - Palindromic Number Time limit : 2sec / Memory ...

  4. AtCoder Beginner Contest 057 ABCD题

    A - Remaining Time Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Dol ...

  5. AtCoder Beginner Contest 051 ABCD题

    A - Haiku Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement As a New Yea ...

  6. AtCoder Beginner Contest 052 ABCD题

    A - Two Rectangles Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement The ...

  7. AtCoder Beginner Contest 054 ABCD题

    A - One Card Poker Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Ali ...

  8. AtCoder Beginner Contest 058 ABCD题

    A - ι⊥l Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Three poles st ...

  9. AtCoder Beginner Contest 050 ABC题

    A - Addition and Subtraction Easy Time limit : 2sec / Memory limit : 256MB Score : 100 points Proble ...

随机推荐

  1. 05.JS函数

    前言: 学习一门编程语言的基本步骤(01)了解背景知识(02)搭建开发环境(03)语法规范(04)常量和变量(05)数据类型(06)数据类型转换(07)运算符(08)逻辑结构(09)函数9.函数——f ...

  2. 安卓接入融云IM连接不上??

    融云初始化失败?融云连接失败??连接回调方法不执行???不可能的,就那么几行代码,怎么会有错. 1.项目gradle里添加融云maven仓库 maven {url "https://dl.b ...

  3. Maven 仓库、坐标、常用命令

    maven中的仓库 需要jar包时,先到本地仓库中找,没有就从中央仓库去下载到本地仓库. 中央仓库很多都在国外,下载速度慢.国内的一些公司在自己的服务器上搭建了maven仓库(中央仓库的镜像),供内部 ...

  4. IIS6的文件解析漏洞

    IIS6的默认配置漏洞会把cer.cdx.asa作为asp代码来解析 后缀解析漏洞 /test.asp;.jpg 或者/test.asp:.jpg(此处需抓包修改文件名) IIS6.0 都会把此类后缀 ...

  5. mybatis + oracle 自增 结合navicate

    1.navicate建表 //T_USER表建立序列T_USER_SQCREATE SEQUENCE T_USER_SQ INCREMENT BY NOMAXVALUE NOCYCLE CACHE ; ...

  6. Android开发中按钮的语法

    按钮的主要作用就是触发一个动作,所以会用到监听器. 如何为按钮添加单机事件监听器: 1.匿名内部类作为单机事件监听器 案例: 首先在.xml文件中添加一个按钮一,然后设置其id属性,然后在main里获 ...

  7. 清北学堂—2020.1提高储备营—Day 3(图论初步(二))

    qbxt Day 3 --2020.1.19 济南 主讲:李奥 目录一览 1.图论(kruskal算法,最短路径算法,拓扑排序) 总知识点:图论 一.kruskal算法 1.目的:求图的最小生成树 2 ...

  8. PHP0019:PHP 图像验证码 、图像水印效果 、 生成缩约图

  9. vue(二)--条件语句

    条件语句:v-if     v-else   v-else-if    v-show v-else .v-else-if 必须跟在 v-if 或者 v-else-if之后. 1.v-if <bo ...

  10. ag.百家下三路怎么看,如何玩好百家了

    \/Q同号3908914.百家作为风靡全球的一款游戏,这么多年长盛不衰,是世界各地玩家的心头所好,但是你真的知道怎么玩好百家吗?第一点呢就是心态问题,我个人认为心态好一切都好,光是心态就占了百分之五十 ...