日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

AtCoder Beginner Contest 084(AB)

發布時間:2023/12/1 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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

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 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int n; 6 while(cin>>n){ 7 cout<<24-n+24<<endl; 8 } 9 return 0; 10 } View Code

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

?

1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int a,b; 6 while(cin>>a>>b){ 7 string s; 8 cin>>s; 9 int l=s.length(); 10 int flag=1; 11 for(int i=0;i<l;i++){ 12 if(i==a&&s[i]!='-'){ 13 flag=0; 14 break; 15 } 16 if(i!=a&&!(s[i]<='9'&&s[i]>='0')){ 17 flag=0; 18 break; 19 } 20 } 21 if(flag) cout<<"Yes"<<endl; 22 else cout<<"No"<<endl; 23 } 24 return 0; 25 } View Code

轉載于:https://www.cnblogs.com/shixinzei/p/8342893.html

總結

以上是生活随笔為你收集整理的AtCoder Beginner Contest 084(AB)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。