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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

【CodeForces - 1051B】Relatively Prime Pairs (构造,思维,素数,水题)

發布時間:2023/12/10 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【CodeForces - 1051B】Relatively Prime Pairs (构造,思维,素数,水题) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題干:

You are given a set of all integers from?ll?to?rr?inclusive,?l<rl<r,?(r?l+1)≤3?105(r?l+1)≤3?105and?(r?l)(r?l)?is always odd.

You want to split these numbers into exactly?r?l+12r?l+12?pairs in such a way that for each pair?(i,j)(i,j)?the greatest common divisor of?ii?and?jj?is equal to?11. Each number should appear in exactly one of the pairs.

Print the resulting pairs or output that no solution exists. If there are multiple solutions, print any of them.

Input

The only line contains two integers?ll?and?rr?(1≤l<r≤10181≤l<r≤1018,?r?l+1≤3?105r?l+1≤3?105,?(r?l)(r?l)is odd).

Output

If any solution exists, print "YES" in the first line. Each of the next?r?l+12r?l+12?lines should contain some pair of integers.?GCD?of numbers in each pair should be equal to?11. All?(r?l+1)(r?l+1)?numbers should be pairwise distinct and should have values from?llto?rr?inclusive.

If there are multiple solutions, print any of them.

If there exists no solution, print "NO".

Example

Input

1 8

Output

YES 2 7 4 1 3 8 6 5

解題報告:

? 別忘了輸出YES。

AC代碼:

#include<bits/stdc++.h> #define ll long long using namespace std;int main() {ll l,r;cin>>l>>r;ll cur = l;printf("YES\n");for(ll i = 1; i<=(r-l+1)/2; i++) {printf("%lld %lld\n",cur++,cur++);} return 0; }

?

總結

以上是生活随笔為你收集整理的【CodeForces - 1051B】Relatively Prime Pairs (构造,思维,素数,水题)的全部內容,希望文章能夠幫你解決所遇到的問題。

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