Codeforces Round #232 (Div. 2)

Jun 07, 2016 pm 03:44 PM
pro round

Problems # Name A On Segment's Own Points standard input/output 1 s, 256 MB x1657 B On Corruption and Numbers standard input/output 1 s, 256 MB x925 C On Number of Decompositions into Multipliers standard input/output 1 s, 256 MB x181 D On

Problems

Codeforces Round #232 (Div. 2)

 

 

# Name    
A

On Segment's Own Points

standard input/output

1 s, 256 MB
Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) x1657
B

On Corruption and Numbers

standard input/output

1 s, 256 MB
Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) x925
C

On Number of Decompositions into Multipliers

standard input/output

1 s, 256 MB
Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) x181
D

On Sum of Fractions

standard input/output

2 s, 256 MB
Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) x134
E

On Changing Tree

standard input/output

2 s, 256 MB
Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) Codeforces Round #232 (Div. 2) x34


A题:n个区间,你可以选择第一个区间上的位置,后面n-1行是被占掉的区间,求你最多能占多长的区间。

思路:n才100,直接暴力,把出现过的区间标记掉,最后去遍历一遍即可。

B题:你有l-r的硬币,要组合出x的钱,问能否组合。

思路:可以的区间为1*[l,r], 2 * [l,r], 3 * [l,r]....直到后面区间重合了之后都是一直可以的,所以用x / l求出i。然后乘上r判断n在不在区间内即可。

C题:m是a1*a2*a3..*an。问m有几种分解成n个数相乘的不同方法。

思路:先分解所有a的分解成质因子,然后等同于把质因子放入n个位置去,用隔板法,每个质因子的方法为C(n - 1 + k) (n - 1)种,k为该质因子个数。

D题:求出题目给定公式值。

思路:先推公式1/u(i) * 1/v(i) = 1/(v(i) - u(i)) * (1/v(i) - 1/u(i))。如此一来前面每一项等于(1/2 - 1/3) + (1/3 - 1/5) + (1/5 - 1/7).....(1/m - 1/n) = 1/2 - 1/n。然后关键就变成找出n的上下质数,这步用暴力枚举,直到是质数为止。然后求出总和即可。

E题:n个点的有根树,根为1,操作1在v结点添加,距离为i的子节点添加值为x - i * k。2为询问。

思路:树状数组,在添加的时候,先假设是从根添加,这样要多添加k * dep[v]。然后开2个树状数组一个记录sum和一个记录k。这样一来最后答案变为

sum - k * dep[v];

代码:

A:

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int N = 105;
int n, i, vis[N], l, r, ll, rr;

int main() {
    scanf("%d", &amp;n);
    scanf("%d%d", &amp;ll, &amp;rr);
    for (i = 2; i <br>
B:
<pre class="brush:php;toolbar:false">#include <stdio.h>
#include <string.h>

int t;
__int64 n, l, r, i;

bool solve() {
    if (n <br>
C:
<pre class="brush:php;toolbar:false">#include <stdio.h>
#include <string.h>
#include <math.h>
#include <map>
using namespace std;

const int MOD = 1000000007;
const int N = 505;
const int MAXN = 20005;
int n, a, cnt = 0, num[MAXN], c[20005][1005];
map<int> v;

void getnum(int x) {
	for (int i = 2; i * i <br>
D:
<pre class="brush:php;toolbar:false">#include <stdio.h>
#include <string.h>

const int MAXN = 100005;
int t;
__int64 n, l, r, prime[MAXN], vis[MAXN], pn = 0;

void init() {
	for (int i = 2; i <br>
E:
<pre class="brush:php;toolbar:false">#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
const int N = 300005;
const int MOD = 1000000007;
int n, Q, i, nod, vis[N];
__int64 kbit[N], sbit[N], cnt = 0, l[N], r[N], dep[N];
vector<int> g[N];
void dfs(int u, __int64 d) {
    vis[u] = 1; dep[u] = d;
    cnt++; l[u] = cnt;
    for (int i = 0; i  0) {
        ans = (ans + num[x]) % MOD;
        x -= (x&amp;(-x));
    }
    return ans;
}

int main() {
    scanf("%d", &amp;n);
    for (i = 2; i <br>
<br>

<p><br>
</p>


</int></vector></string.h></stdio.h>
ログイン後にコピー
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットな記事タグ

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Xiaomi Mi Pad 6とPro、どちらを買う価値がありますか? Xiaomi Mi Pad 6とPro、どちらを買う価値がありますか? Feb 07, 2024 pm 08:36 PM

Xiaomi Mi Pad 6とPro、どちらを買う価値がありますか?

iPhone 15 Pro Max と iPhone 14 Pro Max: 両者の比較と違いは何ですか? iPhone 15 Pro Max と iPhone 14 Pro Max: 両者の比較と違いは何ですか? Sep 19, 2023 pm 08:29 PM

iPhone 15 Pro Max と iPhone 14 Pro Max: 両者の比較と違いは何ですか?

Xiaomi Mi Band 8proの起動方法 Xiaomi Mi Band 8proの起動方法 Jan 14, 2024 am 08:51 AM

Xiaomi Mi Band 8proの起動方法

MacBook AirとProの違い MacBook AirとProの違い Feb 08, 2024 am 09:57 AM

MacBook AirとProの違い

Apple の A17 Pro GPU はどのような変化をもたらすのでしょうか? Apple の A17 Pro GPU はどのような変化をもたらすのでしょうか? Sep 18, 2023 pm 08:53 PM

Apple の A17 Pro GPU はどのような変化をもたらすのでしょうか?

Xiaomi Pro14の発売日 Xiaomi Pro14の発売日 Jan 05, 2024 pm 02:50 PM

Xiaomi Pro14の発売日

20 倍ズームを備えた 3 台のカメラ、Honor が Xiaopai Smart Camera Pro を選択 イノベーションが到来 20 倍ズームを備えた 3 台のカメラ、Honor が Xiaopai Smart Camera Pro を選択 イノベーションが到来 Aug 23, 2024 pm 09:44 PM

20 倍ズームを備えた 3 台のカメラ、Honor が Xiaopai Smart Camera Pro を選択 イノベーションが到来

間違った iPhone 15 Pro と Pro Max を購入しないでください: 3 つの違い 間違った iPhone 15 Pro と Pro Max を購入しないでください: 3 つの違い Sep 14, 2023 pm 09:57 PM

間違った iPhone 15 Pro と Pro Max を購入しないでください: 3 つの違い

See all articles