code forces 1176 D. Recover it!】的更多相关文章

原题链接:https://codeforces.com/contest/1176/problem/D 题目大意是 两个个数列 a , b 相同 ,如果 ai 是素数,那么b数列里添加上第ai个素数(2为第一个),如果不是素数,那么b数列里添加上ai的最大因子.现在给出添加完之后的b数列,求出a数列. 大致思路: 先从大到小排序,然后判断是不是素数,如果是素数,那就遍历一遍,找到它是第几个素数,然后输出并记录下来. 如果不是素数,就直接输出,再求出最大的因子记录下来. 写超时了好多次,修改了很多地…
思维题--code forces round# 551 div.2 题目 D. Serval and Rooted Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Now Serval is a junior high school student in Japari Middle School, and he is…
Code Forces 796C Bank Hacking 题目大意 给一棵树,有\(n\)个点,\(n-1\)条边,现在让你决策出一个点作为起点,去掉这个点,然后这个点连接的所有点权值+=1,然后再将这些刚刚加过一的点的相邻的点的权值+=1 也就是说,除了与根节点相邻的点+=1,其余点+=2 然后求最大集合的最小点权 solution 一看是要求最大的的最小值,首先想到的就是二分,显然想到这个目前没有什么卵用,二分是用来卡最佳答案的,所以使用二分的前提是要给它一个范围去选择,那么现在的任务就是…
Code Forces 833 A The Meaningless Game 题目大意 有两个人玩游戏,每轮给出一个自然数k,赢得人乘k^2,输得人乘k,给出最后两个人的分数,问两个人能否达到这个分数 不得不吐槽一下那么长的英文题面翻译完只有一句话-- solution 也很好想叭 乘积开立方判断是否为两个数的因数 如果是的话,显然不成立 否则输出Yes即可 #include <iostream> #include <cstring> #include <cstdio>…
题目描述 Programmers working on a large project have just received a task to write exactly mm lines of code. There are nn programmers working on a project, the ii -th of them makes exactly a_{i}ai​ bugs in every line of code that he writes. Let's call a…
Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa's land. People in Arpa's land are numbered from 1…
Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n ≥ 2) bur…
/* * Watermelon.cpp * * Created on: 2013-10-8 * Author: wangzhu */ /** * 若n是偶数,且大于2,则输出YES, * 否则输出NO */ #include<cstdio> #include<iostream> using namespace std; int main() { int n; while (~scanf("%d", &n)) { && (n & )…
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */ #include<cstdio> #include<iostream> using namespace std; #define NMAX 100010 struct Node { //index:表示两个数直接的距离(-1:表示未开始,0:表示开始:> 0:表示有了距离 //val:记录最后一次的位置 //flag:不符合条件 (0:表示符合条件,1:表示不符…
D - Laying Cables Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u One-dimensional country has n cities, the i-th of which is located at the point xi and has population pi, and all xi, as well as all pi, are distinct. Whe…