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. HttpMessageNotReadableException

    HttpMessageNotReadableException 情况描述: spring boot web项目,尝试使用热部署工具. Controller只写了用来测试异常的方法, 异常处理器去捕获异 ...

  2. Git操作:绑定上传已存在的仓库到Github

    之前使用github都是创建一个全新的仓库,然后clone下来用,但如果我已经有一个正在使用的仓库,想要绑定上传已存在的仓库到github,怎么做呢?其实在github创建仓库的时候会提示: …or ...

  3. badboy录制,出现弹框提示脚本错误解决方法

    录制的时候经常出现如下问题: 结合网上一些资料,发现如下设置可以解决,具体原理不太清楚,但能达到效果(后期探究一下是为什么,如有知道的朋友,请赐教)

  4. 解决Python3下map函数的显示问题

    今天小编就为大家分享一篇解决Python3下map函数的显示问题,具有很好的参考价值,希望对大家有所帮助.一起跟随小编过来看看吧map函数是Python里面比较重要的函数,设计灵感来自于函数式编程.P ...

  5. ggEditor流程图增加网格背景

    参考官方文档: https://www.yuque.com/antv/g6/plugin.tool.grid react-ggEditor如何使用 import { Flow } from 'gg-e ...

  6. Essential C++ 笔记-1

    本文作者为C++初学者,学习之中难免有误,该文章仅为参考 面向对象概述 继承:改变类之间的关系 多态:让基类的pointer或refence得以十分透明的指向基类的某个派生对象 继承 继承发生在对象与 ...

  7. win10自带邮箱如何使用?win10自带邮箱如何同步qq邮箱邮件?

    win10自带邮箱如何使用? 相信很多小伙伴在登录win10自带的邮箱登录QQ邮箱时,显示同步失败或者登录超时,但又找不到相关的资料,下面是我自己邮箱的操作流程,小伙伴可以尝试一下,有什么问题留言即可 ...

  8. 吴裕雄--天生自然HADOOP操作实验学习笔记:tf-idf算法

    实验目的 通过实验了解tf-idf算法原理 通过实验了解mapreduce的更多组件 学会自定义分区,读写缓存文件 了解mapreduce程序的设计方法 实验原理 1.TF-IDF简介 TF-IDF( ...

  9. 电脑和手机上常用apk或Pc软件的重要目录或文件或文件夹路径

    常用apk或Pc软件的重要目录或文件或文件夹路径 01.hosts文件位置在哪里 C:\Windows\System32\drivers\etc 02.Windows7的锁屏壁纸目录在哪 C:\Win ...

  10. PHP0010:PHP操作mysql

    cmd中清除之前的记录 cmd操作数据库的步骤: php 到 mysql的并发数 15个左右 for循环是要知道起点和终点 foreach是从结果集中取数据 而while可遍历自然结果集