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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

【CodeForces - 472A】Design Tutorial: Learn from Math (tricks,思维,数论,打表)

發布時間:2023/12/10 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【CodeForces - 472A】Design Tutorial: Learn from Math (tricks,思维,数论,打表) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題干:

One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.

For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two primes". Let's modify it. How about a statement like that: "each integer no less than 12 can be expressed as the sum of two composite numbers." Not like the Goldbach's conjecture, I can prove this theorem.

You are given an integer?n?no less than 12, express it as a sum of two composite numbers.

Input

The only line contains an integer?n?(12?≤?n?≤?106).

Output

Output two composite integers?x?and?y?(1?<?x,?y?<?n)?such that?x?+?y?=?n. If there are multiple solutions, you can output any of them.

Examples

Input

12

Output

4 8

Input

15

Output

6 9

Input

23

Output

8 15

Input

1000000

Output

500000 500000

Note

In the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.

In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.

題目大意:

? 給你一個不小于12的整數,讓你分解成兩個合數。

解題報告:

? 看似不顯然,,但是其實很顯然啊,如果是偶數那就輸出4和n-4? 或者6 和n-6這樣的都行。如果是奇數那就輸出9 和 n-9。做題的時候傻了吧唧的寫了個素數打表。得虧數據給的小是1e6,,要是1e18這樣的還真不好辦了(不過要是給那樣的數據也就回去想規律了2333)。

AC代碼:

#include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<map> #include<vector> #include<set> #include<string> #include<cmath> #include<cstring> #define ll long long #define pb push_back #define pm make_pair #define fi first #define se second using namespace std; const int MAX = 2e6 + 5; bool is[MAX]; void prime() {memset(is,1,sizeof is);is[0]=is[1]=0;for(int i = 2; i<=1000000; i++) {if(is[i]) {for(int j = i+i; j<=1000000; j+=i) is[j]=0; }} } int main() {prime();int n;cin>>n;for(int i = 3; i*2<=n; i++) {if(is[i]==0 && is[n-i] == 0) {printf("%d %d\n",i,n-i);break;}}return 0 ;}

?

總結

以上是生活随笔為你收集整理的【CodeForces - 472A】Design Tutorial: Learn from Math (tricks,思维,数论,打表)的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 久久成年| 美女被草视频在线观看 | 天天色影 | 九九五月天 | 91社区视频 | 欧美性jizz18性欧美 | 中国黄色录像一级片 | 国产精品视频久久久久 | 91超碰国产在线 | 久久久久久久久99精品 | 久久成人免费 | 欧美一区二区网站 | 色婷婷18| av丝袜天堂 | 日本不卡一区二区 | 国产精品av免费观看 | 成人黄色国产 | 毛片中文字幕 | 狠狠干伊人| 久久久黄色网 | 日本专区在线 | 色综合影视 | 最近中文字幕在线中文高清版 | 天天操bb| 久久男人av | 国产老头老太作爱视频 | 91在线视频观看 | 日本不卡二区 | 99热在线免费观看 | 色就是欧美| 国产精品久久久久无码av | 中文字字幕一区二区三区四区五区 | 成人免费在线小视频 | jizz国产视频 | 伊人春色在线 | 麻豆一区二区在线观看 | 人妻一区二区三区在线 | 亚洲欧美自拍视频 | 成人三级在线视频 | 日韩欧美成人一区二区三区 | 岳狂躁岳丰满少妇大叫 | 日本欧美色 | 国产成人愉拍精品久久 | 探花视频在线版播放免费观看 | 污污网址在线观看 | 久国产 | 国产精品二区一区二区aⅴ 一卡二卡三卡在线观看 | 国产一级在线免费观看 | 有码中文 | 久久久精品国产免费爽爽爽 | 久久久久久激情 | 欧美日韩午夜精品 | 亚洲色网址 | 黄色自拍网站 | 日欧视频 | 亚洲精品国偷拍自产在线观看蜜桃 | 尤物国产在线 | 91丝袜呻吟高潮美腿白嫩在线观看 | 中文字幕在线一区 | 欧美美女网站 | 亚洲一区二区三区国产 | 丝袜熟女一区二区 | 精品久久久久久无码人妻 | 美女露胸软件 | 久久538| 国产亚洲一区二区三区 | 先锋资源在线视频 | 日韩久久免费 | 日本va欧美va欧美va精品 | 伊人久久国产 | 日本国产精品一区 | 日本黄色网络 | 国产精品视频 | 91情侣视频 | av先锋影音| 丰满人妻一区二区 | 丰满熟女人妻一区二区三 | 黄色网在线免费观看 | 未满十八18禁止免费无码网站 | 一本视频在线 | 久草aⅴ| 不卡av免费观看 | 国产乱码精品一区二区三区五月婷 | 超碰免费在线97 | 亚洲爆乳无码一区二区三区 | 少妇人妻在线视频 | 欧美黄色一级生活片 | 高清国产午夜精品久久久久久 | 国产又黄又骚 | 奇米在线播放 | 波多野结衣中文字幕一区 | 对白刺激theporn | 中文字幕一区二区人妻电影丶 | 美国黄色一级大片 | 色就色欧美| 136fldh导航福利微拍 | 国产做爰免费视频观看 | 麻豆av一区二区三区久久 | 欧美日韩亚洲国产一区 |