A - New Year

题目链接:https://abc084.contest.atcoder.jp/tasks/abc084_a


Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Constraints

  • 1≤M≤23
  • M is an integer.

Input

Input is given from Standard Input in the following format:

M

Output

If we have x hours until New Year at M o'clock on 30th, December, print x.


Sample Input 1

Copy
21

Sample Output 1

Copy
27

We have 27 hours until New Year at 21 o'clock on 30th, December.


Sample Input 2

Copy
12

Sample Output 2

Copy
36
 #include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n){
cout<<-n+<<endl;
}
return ;
}

B - Postal Code

题目链接:https://abc084.contest.atcoder.jp/tasks/abc084_b


Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.

You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.

Constraints

  • 1≤A,B≤5
  • |S|=A+B+1
  • S consists of - and digits from 0 through 9.

Input

Input is given from Standard Input in the following format:

A B
S

Output

Print Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.


Sample Input 1

Copy
3 4
269-6650

Sample Output 1

Copy
Yes

The (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.


Sample Input 2

Copy
1 1
---

Sample Output 2

Copy
No

S contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.


Sample Input 3

Copy
1 2
7444

Sample Output 3

Copy
No

 #include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b){
string s;
cin>>s;
int l=s.length();
int flag=;
for(int i=;i<l;i++){
if(i==a&&s[i]!='-'){
flag=;
break;
}
if(i!=a&&!(s[i]<=''&&s[i]>='')){
flag=;
break;
}
}
if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return ;
}

AtCoder Beginner Contest 084(AB)的更多相关文章

  1. AtCoder Beginner Contest 083 (AB)

    A - Libra 题目链接:https://abc083.contest.atcoder.jp/tasks/abc083_a Time limit : 2sec / Memory limit : 2 ...

  2. AtCoder Beginner Contest 254(D-E)

    Tasks - AtCoder Beginner Contest 254 D - Together Square 题意: 给定一个N,找出所有不超过N的 ( i , j ),使得( i * j )是一 ...

  3. AtCoder Beginner Contest 086 (ABCD)

    A - Product 题目链接:https://abc086.contest.atcoder.jp/tasks/abc086_a Time limit : 2sec / Memory limit : ...

  4. AtCoder Beginner Contest 085(ABCD)

    A - Already 2018 题目链接:https://abc085.contest.atcoder.jp/tasks/abc085_a Time limit : 2sec / Memory li ...

  5. AtCoder Beginner Contest 264(D-E)

    D - "redocta".swap(i,i+1) 题意: 给一个字符串,每次交换相邻两个字符,问最少多少次变成"atcoder" 题解: 从左到右依次模拟 # ...

  6. Atcoder Beginner Contest 155E(DP)

    #definde HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; int main(){ ios: ...

  7. Atcoder Beginner Contest 156E(隔板法,组合数学)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ; ; long long fac[N] ...

  8. Atcoder Beginner Contest 121D(异或公式)

    #include<bits/stdc++.h>using namespace std;int main(){    long long a,b;    cin>>a>&g ...

  9. Atcoder Beginner Contest 155D(二分,尺取法,细节模拟)

    二分,尺取法,细节模拟,尤其是要注意a[i]被计算到和a[i]成对的a[j]里时 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> ...

随机推荐

  1. dedecms清空所有文章怎么操作?sql语句如何写?

    小C新建了一个站,确切的说是复制,出于seo考虑,决定清空所有文章,那么dedecms清空所有文章怎么操作?sql语句如何写呢?特别提醒:修改之前一定要先做好备份,以防万一!下面的语句在迫不得已的情况 ...

  2. mysql主从调优

    mysql主从同步调优 常用选项 适用于Master服务器 binlog-do-db=name 设置Master对哪些库记日志 binlog-ignore-db=name 设置Master对哪些库不记 ...

  3. SQL语法集合

    查询 select   *   from table limit 0,10     取0位置后面的10条记录 limit   0     表示从第一条记录开始   起始位置从0开始 10    表示取 ...

  4. vue axios get请求参数为json对象 而非字符串形式

    axios get请求方式 传递给后台的参数都是字符串下形式,无法传递json对象 或数组对象等    post请求方式则可以实现,   但若后台接口要求必须用get方式传递对象给后台,需要装插件,实 ...

  5. seller【2】Mock数据(接口访问配置)

    Mock数据 在文件[vue.config.js] - devServer 字段 - before(app)函数配置数据接口访问 const appData = require('./data.jso ...

  6. 虚拟货币ICO是什么意思 看完秒懂

    有这样一个市场,与90年代的互联网泡沫及其相似,它被许多金融界大咖怒指为丧失道德底线的圈钱工具,更被投资者而疯狂追捧.是的,没错,它就是近二年火遍全球的虚拟货币ICO.那么,对于很多投资小白来说,虚拟 ...

  7. 10.26 配置psplkf小程序

    环境 服务器 Win Server 2008,nginx, maven, psplkf 标准的mvn工程,可以使用eclipse,导入,file-import-maven project就行, 但是我 ...

  8. Vim的6种基本模式及基本操作

    说明:文章所有内容截选自实验楼教程[Vim编辑器]~ Vim 快速入门 一.实验介绍 1.1 实验内容 本次实验将学习vim中的不同模式和一些基本操作. 1.2 实验知识点 Vim中的六种基本模式 V ...

  9. centos下安卓构建打包太慢

    最近不清楚什么情况,在linux下构建安卓打包时,很慢,很慢...... 之前还是好好的,一个构建三四分钟,现在尽然要两三个小时,人都要崩溃了.... 当时据说公司用的联通网有问题了,正在处理,可是网 ...

  10. [LeetCode] 840. Magic Squares In Grid_Easy

    A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, co ...