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 from0through9.
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> ...
随机推荐
- 设计模式之装饰模式(Decorator)摘录
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/fengbingchun/article/details/29237955 23种GOF设计模式一般分 ...
- windows无法安装到这个磁盘。选中的磁盘采用GPT分区形式 Windows 检测到 EFI 系统分区格式化为 NTFS。将 EFI 系统分区个数化为 FAT32,然后重新启动安装
win10安装问题解决 问题 1.windows无法安装到这个磁盘.选中的磁盘采用GPT分区形式 解决方法: 1.bios,更改 uefi/legacy boot 为ueei only 后面可以安装了 ...
- 唯美MACD
上证30 分钟产生背离,60 分钟高位,但并没有背离,若调整,也是30F 级别的.算是上涨途中的歇脚. 1.股票如果非要从MACD 上去判断怎么拿,那么一句话:要大跌,一般都需要背离.所以,没有背离的 ...
- 比Xshel更好用的 FinalShell
FinalShell功能特点: 1.多平台支持Windows,Mac OS X,Linux 2.多标签,批量服务器管理. 3.支持登录Ssh和Windows远程桌面. 4.漂亮的平滑字体显示,内置10 ...
- js篇-json字符串与json对象相互转化
回调返回结果是 json字符串还是json对象一定要看清楚哦,状态不好的时候,感觉眼神也不好使了, var a = "{"name":"jenny", ...
- sap component 中各个组件的关系
1:
- [django]cbv方式
cbv的方式 1.简单的url from django.views.generic import TemplateView path('', TemplateView.as_view(template ...
- matplot绘图
import matplotlib.pyplot as pltimport numpy as npimport matplotlib # 设置matplotlib正常显示中文和负号matplotlib ...
- VMware下安装Ubuntu18.04时vmware tools安装问题
在VMware下安装Ubuntu18.04时vmware tools关键步骤: 1.快捷键Ctrl+Alt+T,启动命令框,然后切换到root用户(切换命令为:sudo su,回车然后会提示你输入当前 ...
- composer install 遭遇404错误
[Composer\Downloader\TransportException] The "https://packagist.phpcomposer.com/p/provider-2019 ...