A - ABC/ARC


Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise.

You are given Smeke's current rating, x. Print ABC if Smeke will participate in ABC, and print ARC otherwise.

Constraints

  • 1≦x≦3,000
  • x is an integer.

Input

The input is given from Standard Input in the following format:

x

出力

Print the answer.


Sample Input 1

Copy
1000

Sample Output 1

Copy
ABC

Smeke's current rating is less than 1200, thus the output should be ABC.


Sample Input 2

Copy
2000

Sample Output 2

Copy
ARC

Smeke's current rating is not less than 1200, thus the output should be ARC.

题意:1200分作为区分,问打哪一场比赛

解法:模拟

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<)
{
cout<<"ABC";
}
else
{
cout<<"ARC";
}
return ;
}

B - A to Z String


Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

Snuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).

Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.

Constraints

  • 1≦|s|≦200,000
  • s consists of uppercase English letters.
  • There exists a substring of s that starts with A and ends with Z.

Input

The input is given from Standard Input in the following format:

s

Output

Print the answer.


Sample Input 1

Copy
QWERTYASDFZXCV

Sample Output 1

Copy
5

By taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.


Sample Input 2

Copy
ZABCZ

Sample Output 2

Copy
4

Sample Input 3

Copy
HASFJGHOGAKZZFEGA

Sample Output 3

Copy
12
题意:求从A开始到Z最长的字符串能有多长
解法:找到最先出现的A,和最后出现的Z,然后就求长度就行
#include<bits/stdc++.h>
using namespace std;
int main()
{
int st,e;
string s;
cin>>s;
int l=s.length();
for(int i=;i<l;i++)
{
if(s[i]=='A')
{
st=i+;
break;
}
}
for(int i=;i<l;i++)
{
if(s[i]=='Z')
{
e=i+;
}
}
cout<<e-st+<<endl;
return ;
}

C - X: Yet Another Die Game


Time limit : 2sec / Memory limit : 256MB

Score : 300 points

Problem Statement

Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.

Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:

  • Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.

For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.

Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.

Constraints

  • 1≦x≦1015
  • x is an integer.

Input

The input is given from Standard Input in the following format:

x

Output

Print the answer.


Sample Input 1

Copy
7

Sample Output 1

Copy
2

Sample Input 2

Copy
149696127901

Sample Output 2

Copy
27217477801
题意:

给你一个色子,初始的时候任意一个面朝上,每次操作可以将色子翻一下,并且得到此时面朝上的点数并相加,

问你想要得到至少X分,最少需要多少次操作。

解法:我们两次能得到的最大点之和11,10,9,8,7,小于7的我们翻一次就行

 #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin>>n;
ll sum=;
sum+=*(n/);
n%=;
sum+=*(n/);
n%=;
sum+=*(n/);
n%=;
sum+=*(n/);
n%=;
sum+=*(n/);
n%=;
if(n==)
{
cout<<sum<<endl;
}
else
{
cout<<sum+<<endl;
}
return ;
}

D - Card Eater


Time limit : 2sec / Memory limit : 256MB

Score : 400 points

Problem Statement

Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer Ai is written.

He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.

Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.

Constraints

  • 3≦N≦105
  • N is odd.
  • 1≦Ai≦105
  • Ai is an integer.

Input

The input is given from Standard Input in the following format:

N
A1 A2 A3 ... AN

Output

Print the answer.


Sample Input 1

Copy
5
1 2 1 3 7

Sample Output 1

Copy
3

One optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 13 and 7.


Sample Input 2

Copy
15
1 3 5 2 1 3 2 8 8 6 2 6 11 1 1

Sample Output 2

Copy
7

题意:我们每次选择三张牌,去掉最大最小牌,留下一张放回,问最后能留下多少种唯一的牌

解法:每次我们是减去两张,题目给了奇数个,那么留下总数的必定是奇数,我们去重之后看能够得到多少种,偶数种再减去一,奇数保留。

 #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int a[];
cin>>n;
for(int i=;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
int x=unique(a,a+n)-a;
if(x%)
{
cout<<x;
}
else
{
cout<<x-;
}
return ;
}

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

  1. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  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. HTML5 <template>

    http://www.zhangxinxu.com/wordpress/2014/07/hello-html5-template-tag/

  2. MySQL登陆及配置

    一.mysql用户登录 mysql –u用户名 [–h主机名或者IP地址] –p密码 说明:用户名是你登录的用 户,主机名或者IP地址为可选项,如果是本地连接则不需要,远程连接需要填写,密码是对应用户 ...

  3. IE浏览器没有加载CSS或js文件的秘密及解决办法

    其实是两处资料拼成这一篇博文的,因为在开发过程中遇到,有的文章只是说明原因,而没有给出解决方案,所以再次给出解释和解决方法,以供参考,如果有好的解决方法,也请分享下! ---------------- ...

  4. hadoop学习之旅2

    集群搭建文档1.0版本 1. 集群规划 所有需要用到的软件: 链接:http://pan.baidu.com/s/1jIlAz2Y 密码:kyxl 2.0 系统安装 2.1 主机名配置 vi /etc ...

  5. 字符编码乱码问题(servlet底层 编码大揭秘)

    好多初学者会遇到,请求过去的信息内包含中文(一般会是get方式提交过去的请求会出现).好郁闷,这是为什么呢.有下面分析下,说的不好可以吐槽 话说我们能遇到这种编码的问题,归根结底就是这  这 web开 ...

  6. poj图论解题报告索引

    最短路径: poj1125 - Stockbroker Grapevine(多源最短路径,floyd) poj1502 - MPI Maelstrom(单源最短路径,dijkstra,bellman- ...

  7. 页面渲染——页面合成(composition)的优化

    合成(composition)意味着将网页中已经绘画好的部分结合在一起,且展示在屏幕上. 坚持使用transform和opacity属性来操作你的动画animation 在有动画的元素上使用 will ...

  8. hdu-5666 Segment(俄罗斯乘法or大数乘法取模)

    题目链接: Segment Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others) P ...

  9. Apktool 和 Jeb 给出的不同的smali语法

    今天发现用Apktool和Jeb反编译出来的smali在语法上有一定区别,比如一个Java函数: private void packageNameCheck() { com.example.testf ...

  10. 属性(@property)的修饰词有哪些,各自是什么作用,在哪种情况下用?

       之前面试了几家公司,都会问到这个基础的问题,以前,没有怎么注意,所以答的很混乱,所以查了查网上的资料,特意整理了一份.   常见修饰词有:assign.weak.strong.retain.co ...