国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

codeforces260div2A,B,C_html/css

來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 15:54:33
文檔

codeforces260div2A,B,C_html/css

codeforces260div2A,B,C_html/css_WEB-ITnose:A:水題,結(jié)構(gòu)體排序后,看兩個(gè)數(shù)組的是否序列相同。 B:分別寫出來(lái)1,2,3,4,的n次方對(duì)5取余。你會(huì)發(fā)現(xiàn)和對(duì)5取余有一個(gè)循環(huán)節(jié)。如果%4 = 0,輸出4,否則輸出0. 寫一個(gè)大數(shù)取余就過(guò)了。 B. Fedya and Maths time limit per test
推薦度:
導(dǎo)讀codeforces260div2A,B,C_html/css_WEB-ITnose:A:水題,結(jié)構(gòu)體排序后,看兩個(gè)數(shù)組的是否序列相同。 B:分別寫出來(lái)1,2,3,4,的n次方對(duì)5取余。你會(huì)發(fā)現(xiàn)和對(duì)5取余有一個(gè)循環(huán)節(jié)。如果%4 = 0,輸出4,否則輸出0. 寫一個(gè)大數(shù)取余就過(guò)了。 B. Fedya and Maths time limit per test

A:水題,結(jié)構(gòu)體排序后,看兩個(gè)數(shù)組的是否序列相同。

B:分別寫出來(lái)1,2,3,4,的n次方對(duì)5取余。你會(huì)發(fā)現(xiàn)和對(duì)5取余有一個(gè)循環(huán)節(jié)。如果%4 = 0,輸出4,否則輸出0.

寫一個(gè)大數(shù)取余就過(guò)了。

B. Fedya and Maths

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:

(1n?+?2n?+?3n?+?4n) mod 5

for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).

Input

The single line contains a single integer n (0?≤?n?≤?10105). The number doesn't contain any leading zeroes.

Output

Print the value of the expression without leading zeros.

Sample test(s)

input

output

input

124356983594583453458888889

output

Note

Operation x mod y means taking remainder after division x by y.

Note to the first sample:

#include #include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-9///#define M 1000100///#define LL __int64#define LL long long///#define INF 0x7ffffff#define INF 0x3f3f3f3f#define PI 3.1415926535898#define zero(x) ((fabs(x)>s) { int n= s.size(); int cnt = s[0]-'0'; for(int i = 1; i < n; i++) { cnt %= 4; cnt = (cnt*10+(s[i]-'0'))%4; } if(cnt%4 == 0) cout<<4<

C:給你一些數(shù),你取了一個(gè)數(shù)那么比這個(gè)數(shù)大1,和小1的數(shù)字就會(huì)被刪掉。問(wèn)你最大能取到的數(shù)的和。

先根據(jù)數(shù)字進(jìn)行哈希,然后線性的dp一遍,dp[i][1] = ma(dp[i-2][0], dp[i-2][1]) + vis[i]*i,dp[i][0] = max(dp[i-1][0], dp[i-1][1]).1代表取這個(gè)數(shù),0代表不取。注意數(shù)據(jù)類型要用long long。

C. Boredom

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.

Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and delete it, at that all elements equal to ak?+?1 and ak?-?1 also must be deleted from the sequence. That step brings ak points to the player.

Alex is a perfectionist, so he decided to get as many points as possible. Help him.

Input

The first line contains integer n (1?≤?n?≤?105) that shows how many numbers are in Alex's sequence.

The second line contains n integers a1, a2, ..., an (1?≤?ai?≤?105).

Output

Print a single integer ? the maximum number of points that Alex can earn.

Sample test(s)

input

21 2

output

input

31 2 3

output

input

91 2 1 3 2 2 2 2 3

output

10

Note

Consider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2,?2,?2,?2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.


#include #include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-9///#define M 1000100///#define LL __int64#define LL long long///#define INF 0x7ffffff#define INF 0x3f3f3f3f#define PI 3.1415926535898#define zero(x) ((fabs(x)>n) { int x; memset(vis, 0, sizeof(vis)); memset(dp, 0, sizeof(dp)); for(int i = 0; i < n; i++) { scanf("%d",&x); vis[x] ++; } dp[1][1] = vis[1]; dp[2][1] = vis[2]*2; dp[2][0] = dp[1][1]; for(int i = 3; i <= maxn-10; i++) { dp[i][1] = max(dp[i-2][0], dp[i-2][1])+vis[i]*i; dp[i][0] = max(dp[i-1][0], dp[i-1][1]); } cout<

聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

codeforces260div2A,B,C_html/css

codeforces260div2A,B,C_html/css_WEB-ITnose:A:水題,結(jié)構(gòu)體排序后,看兩個(gè)數(shù)組的是否序列相同。 B:分別寫出來(lái)1,2,3,4,的n次方對(duì)5取余。你會(huì)發(fā)現(xiàn)和對(duì)5取余有一個(gè)循環(huán)節(jié)。如果%4 = 0,輸出4,否則輸出0. 寫一個(gè)大數(shù)取余就過(guò)了。 B. Fedya and Maths time limit per test
推薦度:
標(biāo)簽: it cc 2a
  • 熱門焦點(diǎn)

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 亚洲欧美自拍偷拍 | 91精品久久久 | 91一区二区三区 | 国产精品一区二区三区高清在线 | 国产第二十页 | 日日碰日日摸日日澡视频播放 | 91久久精品国产性色也91久久 | 国产精品香蕉一区二区三区 | 一本久久精品一区二区 | 欧美激情91 | 青青草国产免费国产是公开 | 国产在线欧美日韩一区二区 | 亚洲原创区 | 国产小视频在线免费观看 | 欧美亚洲综合网 | 在线中文高清资源免费观看 | 国产人成久久久精品 | 成人一区二区免费中文字幕 | 亚洲欧美日韩高清一区二区一 | 日韩欧美一区二区三区不卡视频 | 欧美精品高清 | 国产欧美日韩在线视频 | 日韩欧美视频在线 | 国产第4页 | 人善交另类欧美重口另类 | 欧美高清视频在线观看 | 国产成人久久 | 欧美精品久久天天躁 | 国产精品香蕉 | 国产在线视频一区 | 国产精品电影一区二区三区 | 国产精彩视频 | 不卡一区二区在线观看 | 久久久久久91精品色婷婷 | 日韩欧美在线视频 | 欧洲亚洲一区 | 成人精品第一区二区三区 | 国产精品国产亚洲精品看不卡 | 自怕偷自怕亚洲精品 | 国产精品一区欧美日韩制服 | 日韩第3页 |