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. IO流(字节流,字符流)

    一,概述 IO流(input output):用来处理设备之间的数据. Java对数据的操作是通过流的对象. Java用于操作流的对象都在IO包中. 流是一组有顺序的,有起点和终点的字节集合,是对数据 ...

  2. java工作流系统jflow表单引擎字段扩展组件介绍

    关键词:工作流快速开发平台  工作流流设计  业务流程管理   asp.net 开源工作流  bpm工作流系统  java工作流主流框架  自定义工作流引擎 表单设计器  流程设计器 装饰类图片 用于 ...

  3. mysql必知必会-创建高级联结

    使用表别名 使用别名引用被检索的表列 别名除了用于列名和计算字段外,SQL还允许给表名起别名.这样做 有两个主要理由: 缩短SQL语句: 允许在单条 SELECT 语句中多次使用相同的表. 可以看到, ...

  4. 【Java】模拟登录教务网并获取数据

    本文章仅做技术交流演示学习,请勿用于违法操作! 前期准备 首先我们需要到要模拟登录的网页,进行抓包操作. 使用Chrome浏览器打开系统的登录页面,按F12打开开发者工具 切换到Network选项卡 ...

  5. fastJson&edis

    fastJson&redis 1. fastJson 1.1 依赖 <dependency> <groupId>com.alibaba</groupId> ...

  6. 大厂面试必问题!HashMap 怎样解决hash桶碰撞?

    HashMap冲突解决方法比较考验一个开发者解决问题的能力.下文给出HashMap冲突的解决方法以及原理分析,无论是在面试问答或者实际使用中,应该都会有所帮助.在Java编程语言中,最基本的结构就是两 ...

  7. ArcGIS Engine开发碰到问题及解决方式

    1.问题描述——运行提示:ArcGIS version not specified. You must call RuntimeManager.Bind before creating any Arc ...

  8. java提取字符串数字,Java获取字符串中的数字

    ================================ ©Copyright 蕃薯耀 2020-01-17 https://www.cnblogs.com/fanshuyao/ 具体的方法如 ...

  9. js增删class的方法

    接下来我来介绍两种方法 我们先来一段HTMl代码 <div id="bb"> 你好呀 </div> 接下来我们再来一段css样式 .ob { color:r ...

  10. 社会工程学 | 浅谈“答题”APP的赌博骗局

    本文写于2018年2月18日,转载于我的知乎文章,请结合实际阅读. 这么多年来在认识的网骗手段越来越多了,考虑到今后工作方向,会继续记录.   微信小程序"头脑王者"被封禁后,更多 ...