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. 前端 HTML body标签相关内容 常用标签 盒子标签 div

    盒子标签 div <div>可定义文档的分区 division的缩写 译:区 <div> 标签可以把文档分割为独立的.将他们进行分区 div在浏览器中,默认是不会增加任何的效果 ...

  2. vs2015智能提示英文改为中文

    vs2015智能提示英文改为中文 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework 进入 \v ...

  3. 微信小程序可以转发给微信好友了

    微信小程序又放大招了:小程序页面可以放置转发按钮,分享更流畅.同时开放了微信运动步数.背景音乐播放等更多基础能力.小程序可以在自己的页面上放置转发按钮,用户点击后,即可将喜欢的内容分享给好友或群聊,体 ...

  4. thinkphp无法安装提示修改mysql配置

    在安装以thinkphp为框架的系统时数据库连接错误,提示修改sql-mode或sql_mode为NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.那我们就顺着提示 ...

  5. RN全局的变量,方法,全局类,全局类方法

    为了方便学习,很简单的小Demo,不懂可以下方留言,百分百原创,相互学习,相互进步 全局的方法 创建一个js文件,命名OvallAll //全局的方法 //这里export default 只能输出一 ...

  6. vue中根据当前时间进行排序

    computed: { newdataList: function() { return this.sortKey(this.dataList, "addtime"); } }, ...

  7. 实例讲解TP5中关联模型

    https://blog.csdn.net/github_37512301/article/details/75675054 一.关联模型在关系型数据库中,表之间有一对一.一对多.多对多的关系.在 T ...

  8. C++的string

    string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,返回npos. string的substr(pos=0, count=npos)返回字符串[pos, pos+count ...

  9. 获取spark-submit --files的文件内容

    参考https://community.hortonworks.com/questions/9265/how-can-i-add-configuration-files-to-a-spark-job- ...

  10. 9个Linux系统常用监控命令

    我们的系统一旦上线跑起来我们自然希望它一直相安无事,不要宕机,不要无响应,不要慢腾腾的.但是这不是打开机器电源然后放任不管就可以得到的.所以我们要监视系统的运行状况,发现问题及时处理. 对于系统和网络 ...