做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題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關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

CodeforcesRound#280(Div.2A,B,C,D,E)_html/css

來源:懂視網 責編:小采 時間:2020-11-27 15:59:18
文檔

CodeforcesRound#280(Div.2A,B,C,D,E)_html/css

CodeforcesRound#280(Div.2A,B,C,D,E)_html/css_WEB-ITnose:改了時區之后打cf更辛苦了啊。昨天沒做,今天補了一下啊。 A. Vanya and Cubes 每次加的數規律性很明顯就是:(i+1)*i/2。暴力枚舉i就可以得到答案。 #include #include #include #include #include #include #include #
推薦度:
導讀CodeforcesRound#280(Div.2A,B,C,D,E)_html/css_WEB-ITnose:改了時區之后打cf更辛苦了啊。昨天沒做,今天補了一下啊。 A. Vanya and Cubes 每次加的數規律性很明顯就是:(i+1)*i/2。暴力枚舉i就可以得到答案。 #include #include #include #include #include #include #include #

改了時區之后打cf更辛苦了啊。。昨天沒做,今天補了一下啊。

A. Vanya and Cubes

每次加的數規律性很明顯就是:(i+1)*i/2。暴力枚舉i就可以得到答案。

#include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-8#define M 1000100#define LL long long//#define LL long long#define INF 0x3f3f3f#define PI 3.1415926535898#define mod 1000000007#define rson mid+1, r, rt<<1|1#define lson l, mid, rt<<1#define root 0, ans-1, 1const int maxn = 1001;using namespace std;int main(){ int n; while(~scanf("%d",&n)) { int ans = 1; int sum = 1; while(1) { ans++; sum += (ans+1)*ans/2; if(sum >= n) break; } if(sum > n) ans--; cout< 
B - Vanya and Lanterns

按照順序排序,之后求出間距最小的來,注意判斷起點與終點,因為他們的距離不用/2。

#include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-8#define M 1000100#define LL long long//#define LL long long#define INF 0x3f3f3f#define PI 3.1415926535898#define mod 1000000007#define rson mid+1, r, rt<<1|1#define lson l, mid, rt<<1#define root 0, ans-1, 1const int maxn = 1010;using namespace std;int num[maxn];int main(){ int n, d; while(~scanf("%d %d",&n, &d)) { for(int i = 0; i < n; i++) scanf("%d",&num[i]); sort(num, num+n); double Max = 0.0; for(int i = 0; i < n-1; i++) Max = max(Max, (double)((num[i+1]-num[i])*1.0/2)); Max = max(Max, num[0]*1.0-0); Max = max(Max, d*1.0-num[n-1]*1.0); printf("%.12lf\n",Max); } return 0;}

C - Vanya and Exams

C看懂題目就很簡單了啊,就是排序之后的一個貪心。

#include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-8#define M 1000100#define LL long long//#define LL long long#define INF 0x3f3f3f#define PI 3.1415926535898#define mod 1000000007#define rson mid+1, r, rt<<1|1#define lson l, mid, rt<<1#define root 0, ans-1, 1const int maxn = 100010;using namespace std;struct node{ LL a, b;}f[maxn];bool cmp(node a, node b){ return a.b < b.b;}int main(){ LL n, r, ave; while(~scanf("%I64d %I64d %I64d",&n, &r, &ave)) { LL ans = ave*n; LL sum = 0LL; for(int i = 0; i < n; i++) { scanf("%I64d %I64d",&f[i].a, &f[i].b); sum += f[i].a; } sort(f, f+n, cmp); LL xans = 0; for(int i = 0; i < n; i++) { LL p = ans-sum; LL sp = max(r-f[i].a, 0LL); if(p <= 0) break; if(p > sp) { sum += sp; xans += f[i].b*sp; } else { xans += p*f[i].b; sum += p; break; } } cout<

D - Vanya and Computer Game

給你一個x,一個y。讓你判斷在n次以內x,y誰先完成任務,其實就是判斷誰的整數倍先到給的nx,二分枚舉,如果是x,y的公倍數輸出both,如果是y的倍數輸出:Vanya,如果是x的倍數輸出:Vova.

D. Vanya and Computer Game

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency y hits per second. Each character spends fixed time to raise a weapon and then he hits (the time to raise the weapon is 1?/?x seconds for the first character and 1?/?y seconds for the second one). The i-th monster dies after he receives ai hits.

Vanya and Vova wonder who makes the last hit on each monster. If Vanya and Vova make the last hit at the same time, we assume that both of them have made the last hit.

Input

The first line contains three integers n,x,y (1?≤?n?≤?105, 1?≤?x,?y?≤?106) ? the number of monsters, the frequency of Vanya's and Vova's attack, correspondingly.

Next n lines contain integers ai (1?≤?ai?≤?109) ? the number of hits needed do destroy the i-th monster.

Output

Print n lines. In the i-th line print word "Vanya", if the last hit on the i-th monster was performed by Vanya, "Vova", if Vova performed the last hit, or "Both", if both boys performed it at the same time.

Sample test(s)

input

4 3 21234

output

VanyaVovaVanyaBoth

input

2 1 112

output

BothBoth

Note

In the first sample Vanya makes the first hit at time 1?/?3, Vova makes the second hit at time 1?/?2, Vanya makes the third hit at time 2?/?3, and both boys make the fourth and fifth hit simultaneously at the time 1.

In the second sample Vanya and Vova make the first and second hit simultaneously at time 1.

#include #include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-8#define M 1000100#define LL long long//#define LL long long#define INF 0x3f3f3f#define PI 3.1415926535898#define mod 1000const int maxn = 200010;using namespace std;const LL R = 1e15;int main(){ LL n, x, y; while(~scanf("%I64d %I64d %I64d", &n, &x, &y)) { LL nx; for(int i = 0; i < n; i++) { scanf("%I64d",&nx); LL l = 0; LL r = R; while(l < r) { LL mid = (l+r)>>1; if(mid/x+mid/y < nx) l = mid+1; else r = mid; } if(l%x == 0 && l%y == 0) cout<<"Both"<

E - Vanya and Field

這個題目挺好的,其實他是有規律的:

題目的關鍵條件是這個

首先想個問題,先是一維的情況下,假設只有一行的格子,長度為x,每次能移動的距離為dx,而且gcd(x,dx)=1,這樣手動模擬一下,可以發現規律,從某個點出發直到回到這個點上,步數均為x次,而且每次落下的點都是不重復的,也即這x次的位置覆蓋了整條方格上的每一個方格。

那現在二維的情況下,gcd(n,dx) = gcd(n,dy) = 1,也就是從某一行和某一列的交點出發,要重新回到這個交點,就要經過n步而且這n步覆蓋了每一行每一列。每個循環必須每個x走一次以及每個y走一次,n個格子屬于一組循環里面的,總共有n*n個格子,所以有n組循環。一組循環內的格子是等價的。同一行內的n個格子均來自不同的n組。

現在考慮一組特殊的循環,這組循環從(0,0)開始出發

走了第一步以后就到 (dx%n, dy%n)

第二步到 (2*dx%n, 2*dy%n)

第k步到 (k*dx%n, k*dy%n)

用一個對應關系存儲,從(0,0)出發的,經過了k步以后,會到達位置(x[k] , y[k])。

然后考慮普遍的情況了,每組循環都比如經過(0, y0)這個點

從這個點出發的第一步 (dx%n, (y0+dy)%n)

第k步到 (dx%n, (y0+dy)%n), 也即(x[k], (y0+y[k])%n)

那么現在給你某個坐標(x,y),要怎么算出他屬于哪一組循環的呢

根據等式x[k]==x,可以求出對應的k的值

那就能求出對應的y[k]了,然后y0+y[k]==y → y0=y-y[k]

這樣就知道這個(x,y) 是屬于 (0,y0)這一組的了

那么算法大概是這樣:

預處理出x[k],y[k],時間復雜度o(n)

遍歷每一個apple的坐標(x,y),求出對應的坐標(0,y0),然后cnt[y0]++,復雜度o(m)

找出值最大的cnt[y],答案就是(0,y)了。 總復雜度o(n+m)


摘自:http://www.cnblogs.com/someblue/p/4136436.html

E. Vanya and Field

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Vanya decided to walk in the field of size n?×?n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates(xi,?yi). Vanya moves towards vector (dx,?dy). That means that if Vanya is now at the cell (x,?y), then in a second he will be at cell . The following condition is satisfied for the vector: , where is the largest integer that divides both a and b. Vanya ends his path when he reaches the square he has already visited.

Vanya wonders, from what square of the field he should start his path to see as many apple trees as possible.

Input

The first line contains integers n,?m,?dx,?dy(1?≤?n?≤?106, 1?≤?m?≤?105, 1?≤?dx,?dy?≤?n) ? the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi,?yi (0?≤?xi,?yi?≤?n?-?1) ? the coordinates of apples. One cell may contain multiple apple trees.

Output

Print two space-separated numbers ? the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them.

Sample test(s)

input

5 5 2 30 01 21 32 43 1

output

1 3

input

2 3 1 10 00 11 1

output

0 0

Note

In the first sample Vanya's path will look like: (1,?3)?-?(3,?1)?-?(0,?4)?-?(2,?2)?-?(4,?0)?-?(1,?3)

In the second sample: (0,?0)?-?(1,?1)?-?(0,?0)

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define eps 1e-8///#define LL long long#define LL __int64#define INF 0x3f3f3f#define PI acos(-1)#define mod 1000000007using namespace std;const int maxn = 10000010;int vis[maxn];int num[maxn];struct node{ int x, y; int k;}f[maxn];int main(){ int n, m, dx, dy; while(~scanf("%d %d %d %d",&n, &m, &dx, &dy)) { f[0].x = 0; f[0].y = 0; f[0].k = 0; vis[0] = 0; for(int i = 1; i < n; i++) { f[i].x = (f[i-1].x+dx)%n; f[i].y = (f[i-1].y+dy)%n; f[i].k = i; vis[f[i].x] = i; } memset(num, 0, sizeof(num)); int x, y; for(int i = 0; i < m; i++) { scanf("%d %d",&x, &y); int k = vis[x]; int ky = f[k].y; int y0 = (y-ky+n)%n; num[y0]++; } int Max = 0; int sk; for(int i = 0; i < n; i++) { if(Max < num[i]) { Max = num[i]; sk = i; } } cout<<0<<" "<

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

CodeforcesRound#280(Div.2A,B,C,D,E)_html/css

CodeforcesRound#280(Div.2A,B,C,D,E)_html/css_WEB-ITnose:改了時區之后打cf更辛苦了啊。昨天沒做,今天補了一下啊。 A. Vanya and Cubes 每次加的數規律性很明顯就是:(i+1)*i/2。暴力枚舉i就可以得到答案。 #include #include #include #include #include #include #include #
推薦度:
標簽: 2a () c
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 揭阳市| 郸城县| 嫩江县| 达拉特旗| 洛南县| 桦甸市| 马鞍山市| 沂水县| 多伦县| 秀山| 类乌齐县| 石棉县| 齐河县| 呼伦贝尔市| 灵丘县| 景宁| 浦北县| 登封市| 滦南县| 乃东县| 中山市| 上犹县| 盐山县| 尖扎县| 濮阳市| 北辰区| 高州市| 柳林县| 澎湖县| 齐河县| 鄯善县| 两当县| 无为县| 师宗县| 托克托县| 武隆县| 调兵山市| 甘孜县| 西城区| 滁州市| 荣昌县|