AtCoder Beginner Contest 084(AB)
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
21
Sample Output 1
27
We have 27 hours until New Year at 21 o'clock on 30th, December.
Sample Input 2
12
Sample Output 2
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 from0
through9
.
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
3 4
269-6650
Sample Output 1
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
1 1
---
Sample Output 2
No
S contains unnecessary -
s other than the (A+1)-th character, so it does not follow the format.
Sample Input 3
1 2
7444
Sample Output 3
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)的更多相关文章
- AtCoder Beginner Contest 083 (AB)
A - Libra 题目链接:https://abc083.contest.atcoder.jp/tasks/abc083_a Time limit : 2sec / Memory limit : 2 ...
- AtCoder Beginner Contest 254(D-E)
Tasks - AtCoder Beginner Contest 254 D - Together Square 题意: 给定一个N,找出所有不超过N的 ( i , j ),使得( i * j )是一 ...
- AtCoder Beginner Contest 086 (ABCD)
A - Product 题目链接:https://abc086.contest.atcoder.jp/tasks/abc086_a Time limit : 2sec / Memory limit : ...
- AtCoder Beginner Contest 085(ABCD)
A - Already 2018 题目链接:https://abc085.contest.atcoder.jp/tasks/abc085_a Time limit : 2sec / Memory li ...
- AtCoder Beginner Contest 264(D-E)
D - "redocta".swap(i,i+1) 题意: 给一个字符串,每次交换相邻两个字符,问最少多少次变成"atcoder" 题解: 从左到右依次模拟 # ...
- Atcoder Beginner Contest 155E(DP)
#definde HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; int main(){ ios: ...
- Atcoder Beginner Contest 156E(隔板法,组合数学)
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ; ; long long fac[N] ...
- Atcoder Beginner Contest 121D(异或公式)
#include<bits/stdc++.h>using namespace std;int main(){ long long a,b; cin>>a>&g ...
- Atcoder Beginner Contest 155D(二分,尺取法,细节模拟)
二分,尺取法,细节模拟,尤其是要注意a[i]被计算到和a[i]成对的a[j]里时 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> ...
随机推荐
- 教你一步步composer安装Magento2.3
以前外贸建站一直用zencart,这段时间ytkah比较有时间,就决定用magento来创建一下站点.magento不像普通的程序一样下载就可以直接安装,需要借助composer安装,还没没compo ...
- C#实体对象出现中文处理乱码的问题
问题: C#实体对象使用时,对于是中文的增加时,到数据库后变成了?? 解决方法: 增加实体对象时“新建连接”操作中的高级中要设置属性Character Set=urf8 (要手动输入)
- gh-ost:不一样的在线表结构变更
简介: 2016年8月份,shlomi-noach在GitHub Engineering发文宣布gh-ost开源.gh-ost是什么?一个不依赖触发器实现的在线表结构变更工具. 对于数据库运维人员来说 ...
- cefglue Flash
用户计算机必须安装Adobe Flash组件才能播放动画,关于这点,找到3个解决方案: 方法一:安装NPAPI版本的Flash组件(非IE版)之后,才能播放动画.访问 http://get.adobe ...
- [django]http请求
请求参数 http基本认证 https://zxc0328.github.io/2015/11/04/http-basic-auth/ 我们看到在http请求的header里有一个Authorizat ...
- [dj]django常用设置
关于django版本说明: Django 1.11.x 支持 Python 2.7, 3.4, 3.5 和 3.6(长期支持版本 LTS) 最后一个支持 Python 2.7 的版本 Django 2 ...
- 【LeetCode每天一题】Palindrome Number( 回文数字)
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...
- mac-Navicat Premium 12连接Oracle
安装及破解: https://pan.baidu.com/s/1ip0oM9p856k34t3cIExa7Q(提取码请留言) Navicat连接了Oracle数据库 测试连接失败,提示:hostnam ...
- php 获取 mime type 类型,fileinfo扩展
背景: version < php-5.3 没有API能够查看文件的 mime_type, 故需要编译扩展 fileinfo 来扩展PHP的API(finfo_*系列函数).php-5.3 以后 ...
- CentOS下samba配置心得(smb和nmb都要启动)
印象中以前多次配置成功过,重新配置就把以前的资料找出来: yum安装 samba samba-client samba-swat,然后配置参见:http://www.cnblogs.com/mchin ...