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 ;
}

最新文章

  1. React 入门教程
  2. 基于fis3的组件可视化道路
  3. spring源码:IOC(li)
  4. 【WPF系列】基础 PasswordBox
  5. NSOperationQueue与GCD的使用原则和场景
  6. Integer &amp; int &amp; == &amp; equals
  7. Adroid 总结--android ListView美化,个性化更改的属性
  8. 鸟哥的linux私房菜学习
  9. Context Menu on DataGrid
  10. struts2 jsp表单提交后保留表单中输入框中的值 下拉框select与input
  11. C#微信公众号开发 -- (二)验证成为开发者
  12. Swift - 启动时的向导页(新手引导)的制作
  13. js添加多个样式属性cssText
  14. 一个操作cvs格式的c++类
  15. RedHat Linux关闭防火墙的命令
  16. Fox And Dinner CodeForces - 510E (最大流)
  17. Linux图形操作与命令行
  18. php -- 4种嵌入标记
  19. smarty模板开发基础总结
  20. 在Unity中查找缺失的引用

热门文章

  1. AdvStringGrid常用操作
  2. 006-docker-安装-nginx
  3. error: Microsoft Visual C++ 14.0 is required(line_profiler模块安装失败的解决办法)
  4. 前端框架之Vue(6)-列表渲染
  5. react 脚手架--create-react-app
  6. 2019.03.25 Ajax三级联动
  7. python 微信机器人,微信自动回复
  8. InstallShield12的安装破解方法
  9. python 格式化字符串&quot;%s&quot;%
  10. cocos2dx 3.x(打开网页webView)