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. git出现warning: LF will be replaced by CRLF的解决方法

    今天ytkah用git上传文件的时候出现了warning: LF will be replaced by CRLF的错误,具体信息如下,这是因为跨平台开发下产生的.由于编辑器的不同或者Windows程 ...

  2. SegmentedControlIOS使用

    代码: import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, SegmentedContr ...

  3. jmeter报错:内存溢出

    使用jmeter进行压力测试时,经常会遇到内存溢出错误: 2018-08-28 09:01:26,686 ERROR o.a.j.JMeter: Uncaught exception: java.la ...

  4. PinyinUtil

    import java.util.HashSet;import java.util.Set;import java.util.regex.Matcher;import java.util.regex. ...

  5. 常用笔记:PHP

    [PHP] date_default_timezone_set(PRC); //时区设置 header("Content-type: text/html; charset=utf-8&quo ...

  6. springboot测试

    一.单元测试 在开发阶段的时候最重要的是单元测试了,springboot对单元测试的支持已经很完善了. 1.在pom包中添加spring-boot-starter-test包引用 <depend ...

  7. python3编写发送四种http请求的脚本

    python3编写发送http请求的脚本 使用requests包: http://docs.python-requests.org/zh_CN/latest/user/quickstart.html ...

  8. JDB调试

  9. fullpage插件在移动端弹出键盘页面特殊处理

    fullpage插件大家都很熟悉 jquery一款全屏上下滑动的插件. 最近做公司一个活动移动端使用fullpage插件填写input的时候遇见一个问题,手机自带的键盘弹出的时候会把页面顶出去,页面错 ...

  10. kdevelp 导入makefile工程

    比如upx工程,将upx/src/makefile中makefile改为makefile.am,自用kdevelop导入工程找到makefile.am,生成工程后去掉.am,这样就可以像vs一样调试程 ...