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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题

發(fā)布時(shí)間:2024/10/12 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

A. Dasha and Stairs

題目連接:

http://codeforces.com/contest/761/problem/A

Description

On her way to programming school tiger Dasha faced her first test — a huge staircase!

The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their color. So on some interval of her way she calculated two values — the number of steps with even and odd numbers.

You need to check whether there is an interval of steps from the l-th to the r-th (1?≤?l?≤?r), for which values that Dasha has found are correct.

Input

In the only line you are given two integers a, b (0?≤?a,?b?≤?100) — the number of even and odd steps, accordingly.

Output

In the only line print "YES", if the interval of steps described above exists, and "NO" otherwise.

Sample Input

2 3

Sample Output

YES

Hint

題意

問你在現(xiàn)實(shí)生活中,存不存在一個(gè)起點(diǎn)和一個(gè)終點(diǎn),使得里面的奇數(shù)有a個(gè),偶數(shù)有b個(gè)。

題解:

1.暴力枚舉

2.abs<=1即可,然后特判掉0 0這個(gè)數(shù)據(jù),這個(gè)答案是no

代碼

#include<bits/stdc++.h> using namespace std;int main() {long long a,b;cin>>a>>b;for(int l=0;l<=1000;l++){for(int r=l;r<=1000;r++){int L=0,R=0;for(int k=l;k<=r;k++){if(k%2==0)R++;else L++;}if(L==a&&R==b){cout<<"YES"<<endl;return 0;}}}cout<<"NO"<<endl;return 0; }

轉(zhuǎn)載于:https://www.cnblogs.com/qscqesze/p/6359964.html

總結(jié)

以上是生活随笔為你收集整理的Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。