Codeforces
brav0
练习算法两年半的ACM选手
展开
-
Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final)
比赛连接:https://codeforces.com/contest/1443A - Kids Seating题意:n个人要坐座位,一共4*n个座位,要求两个人的座位号不能互质,且不能一个座位号能被另一个人的座位号整除,要求输出n个人的座位号。思路:首先输出n*2,然后每次加2,满足公约数是2,且因为最大的是2*n-2,所以也不会出现整除的情况。#include<bits/stdc++.h>using namespace std;const int N = 1原创 2020-11-07 00:08:02 · 172 阅读 · 0 评论 -
Codeforces Round #647 (Div. 2) D. Johnny and Contribution
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday Johnny wants to increase his contribution. His plan assumes writingnnblogs. One blog covers one topic, but one topic can be covere..原创 2020-06-05 13:33:26 · 225 阅读 · 0 评论 -
Educational Codeforces Round 86 (Rated for Div. 2)C. Yet Another Counting Problem
C. Yet Another Counting Problemtime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integersaaandbb, andqqqu...原创 2020-04-27 19:06:13 · 438 阅读 · 0 评论 -
Codeforces Round #636 (Div. 3)D. Constant Palindrome Sum(差分 or 线段树)
D. Constant Palindrome Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an arrayaaconsisting ofnnintegers (it...原创 2020-04-22 17:36:08 · 304 阅读 · 0 评论 -
Codeforces Round #601 (Div. 2) D. Feeding Chicken(构造)
time limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLong is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is in...原创 2019-11-20 20:26:08 · 369 阅读 · 0 评论 -
Educational Codeforces Round 76 (Rated for Div. 2)(A~F)
A - Two Rival StudentsYou are the gym teacher in the school.There arennstudents in the row. And there are two rivalling students among them. The first one is in positionaa, the second in positi...原创 2019-11-16 19:03:52 · 242 阅读 · 0 评论 -
Educational Codeforces Round 63 (Rated for Div. 2) D. Beautiful Array (dp)
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array aa consisting of nn integers. Beauty of array is the maximu...原创 2019-05-05 09:40:36 · 123 阅读 · 0 评论 -
Codeforces Round #547 (Div. 3)D:Colored Boots(模拟)
链接:http://codeforces.com/problemset/problem/1141/D题意:给出一个n,接着给出两个长度为n的字符串,由?和小写字母组成,两个相同的小写字母可以配成一副,?和任意的字母都可以配对,问这两个串互相配对,最多多少组,输出任意的配对方案;因为?是任意都可以的,所以可以先枚举26个小写字母,将能通过字母配对的进行字母配对,最后再消耗?来配对,若...原创 2019-03-20 19:56:17 · 127 阅读 · 1 评论 -
Codeforces Round #547 (Div. 3)C: Polycarp Restores Permutation(递推)
链接:http://codeforces.com/problemset/problem/1141/C题意:给一个n,再给出n-1个数,n-1个数为数组q,要求出数组p,满足qi=pi+1−pi. 并且p数组内的n个数字包含1~n的每个数字,如果可以输出p数组,否则输出-1因为给出了递推式和q数组,所以只要求出p数组的一个元素,就可以推出其他元素,将递推式化一下可以得到pi+1=pi...原创 2019-03-20 19:43:03 · 121 阅读 · 1 评论 -
CodeForces C:Connect (BFS+暴力)
Alice lives on a flat planet that can be modeled as a square grid of size n×nn×n , with rows and columns enumerated from 11 to nn . We represent the cell at the intersection of row rr and column cc wi...原创 2019-02-27 15:32:24 · 993 阅读 · 0 评论 -
Codeforces A. Salem and Sticks(暴力)
Salem gave you nn sticks with integer positive lengths a1,a2,…,ana1,a2,…,an .For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). T...原创 2019-01-21 10:05:02 · 391 阅读 · 0 评论