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. WSDL文档深入分析

    借助jdk的wsimort.exe工具生成客户端代码 格式:wsimport -keep url   //url为wsdl文件的路径 直接生成客户端代码会抛异常, 无法生成客户端代码, 解决办法: 将 ...

  2. android DHCP流程【转】

    本文转载自:http://blog.csdn.net/myvest/article/details/51483647 版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[+]   1 ...

  3. Ubuntu Linux系统环境变量配置文件【转】

    本文转载自:https://my.oschina.net/qinlinwang/blog/30471 Ubuntu Linux系统环境变量配置文件:  /etc/profile : 在登录时,操作系统 ...

  4. 异常描述:hibernate懒加载中,用OpenSessionInViewFilter解决之后,同时对一个collection创建两个session访问导致异常(Illegal attempt to associate a collection with two open sessions)

    在保存的时候如果使用以下方法就会报错 解决:使用merge()方法就可以解决异常... merge()方法的解释: 传入的参数在数据库中不存在的时候会添加一条数据,根据主键判断已存在的时候会更新这条数 ...

  5. Codeforces Round #385 (Div. 2) Hongcow Builds A Nation —— 图论计数

    题目链接:http://codeforces.com/contest/745/problem/C C. Hongcow Builds A Nation time limit per test 2 se ...

  6. Java8初体验(2):Stream语法详解

    原文出处: 一冰_天锦 上篇文章Java8初体验(1):lambda表达式语法比较详细的介绍了lambda表达式的方方面面,细心的读者会发现那篇文章的例子中有很多Stream的例子.这些Stream的 ...

  7. 闪动的Label控件

    带闪动效果带控件,目前只有Label,以后会逐步增加,如果有好看带效果也欢迎您带加入. 如果可能,请在github中star,您的支持是我继续完善的动力,非常感谢. 测试环境:Xcode 5.0,iO ...

  8. Duplicate files copied in APK META-INF/DEPENDENCIES

    在app的目录下找到build.gradle 这个文件,在android标签的最后面加入以下信息: packagingOptions { exclude 'META-INF/DEPENDENCIES' ...

  9. RequireJS 配置理解

    RequireJS 配置: 1.首先加载RequireJS文件 <script src="//cdn.bootcss.com/require.js/2.1.22/require.js& ...

  10. 对Webview跨源攻击的理解

    首先是addJavaScriptInterface漏洞: 有时候访问手机百度贴吧网页版本,网页上会有个按钮提示用手机应用打开.这种交互通常都是使用JS来实现,而WebView已经提供了这样的方法,具体 ...