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. windows server 2008 + IIS 7.5实现多用户FTP(多账号对应不同目录

    在windows server 2003 + IIS 6 的时候,就已经能实现多用户FTP的功能,不过设置有写繁琐,如果站点多的话,设置账号.权限这些东西都要搞很久.Windows server 20 ...

  2. eval函数用法

    JavaScript 全局对象 定义和用法 eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码. 语法 eval(string) 参数 描述 string 必需.要计算的字 ...

  3. Codeforces Round #178 (Div. 2) B. Shaass and Bookshelf —— DP

    题目链接:http://codeforces.com/contest/294/problem/B B. Shaass and Bookshelf time limit per test 1 secon ...

  4. BLOB二进制大数据

    What is a Blob? A blob object represents a chuck of bytes that holds data of a file. But a blob is n ...

  5. Python:元组

    元组:只读,不能修改,使用小括号 创建元组: tup1 = ('physics', 'chemistry', 1997, 2000) tup2 = (1, 2, 3, 4, 5 ) tup3 = &q ...

  6. jquery的跨域请求

    项目中关于ajax jsonp的使用,出现了问题:可以成功获得请求结果,但没有执行success方法总算搞定了,记录一下 function TestAjax() {    $.ajax({       ...

  7. Field 'CID' doesn't have a default value

    解决:在数据库客户端navicat中设计表勾选自动递增

  8. Nagios监控Windows的网卡流量

    Nagios监控Windows的网卡流量 使用/usr/local/nagios/libexec/中的check_traffic.sh,不但可以监控Linux的网卡流量,也可以监控Windows服务器 ...

  9. dcos下rexray服务的配置

    在dcos环境下,rexray服务的默认配置文件为/opt/mesosphere/etc/rexray.conf,而其服务文件则是 /etc/systemd/system/dcos-rexray.se ...

  10. 三 vue学习三 从读懂一个Vue项目开始

    源码地址:     https://github.com/liufeiSAP/vue2-manage 我们的目录结构: 目录/文件 说明 build 项目构建(webpack)相关代码. config ...