CodeForces 805A Fake NP】的更多相关文章

直觉. 一段区间中,肯定是$2$的倍数最多,因为区间长度除以$2$得到的数字最大.但只有$1$个数字的时候需要特判. #include <cstdio> #include <cmath> #include <set> #include <cstring> #include <algorithm> using namespace std; int L,R; int main() { while(~scanf("%d%d",&am…
A. Fake NP time limit per test   1 second memory limit per test   256 megabytes   Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integer…
A. Fake NP 传送门:http://codeforces.com/contest/805/problem/A 本题是一个数学问题. 给定两个正整数l,r(l≤r),对于区间[l..r]上的任一整数,写出其除1以外的所有因数,求区间[l..r]上出现频率最高的一个因数. 结论:若l=r,则答案为l(或r),否则为2.参考程序如下: #include <stdio.h> int main(void) { int l, r; scanf("%d%d", &l, &…
A. Fake NP time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.…
Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Fi…
[题目链接]:http://codeforces.com/contest/805/problem/A [题意] 问你在l..r这个区间内的所有数字: 对于每个数的因子; 出现次数最多的是哪一个; [题解] 正常情况下; 求l..r内的出现的因子数 可以转化成1..l-1和1..r两个部分来求; 后者减去前者就好; 都需要枚举2的倍数在1..x里面有多少个,3的倍数在1..x里面-. 即x/2个和x/3个- 以此类推; 显然每次都是2的倍数最多啦; 但是有例外吧 就是l==r的时候,且l为奇数的时…
原文链接http://www.cnblogs.com/zhouzhendong/p/9026184.html 题目传送门 - Codeforces 802I 题意 求一个串中,所有本质不同子串的出现次数的平方和. $|s|\leq 10^5$ 题解 首先,这一题用 SAM 做就是模板题,比较简单. 但是,本着练一练 SA 的心态,我开始了 SA+单调栈 的苦海. 真毒瘤. 这里讲一讲 SA 的做法,也是经典的做法. SA 闭着眼睛先写了再说. 首先,我们考虑出现次数大于 $1$ 次的子串. 考虑…
Codeforces 802I 题意:统计所有不同子串出现次数的平方的和. 想法:建一个SAM,$Ans=\sum (step[i]-step[fa[i]])*right[i]^2$ #include<cstdio> #include<cstring> #include<algorithm> typedef long long ll; template inline void read(T&x) { x=0;bool f=0;char c=getchar();…
题目大意: 传送门. 给一个n个点的有向完全图(即任意两点有且仅有一条有向边). 每一个点上有$S_i$个人,开始时其中有些人有真金块,有些人没有金块.当时刻$i$时,若$u$到$v$有边,若$u$中第$i%S_u$个人有金块(无论真假),且$v$中第$i%S_v$个人没有金块,则会给$v$中第$i%S_v$个人一个假金块. 假设这样传递了无数次.(即不会再满足上面的条件时) 最后,拥有真金块的人一定可以把金子买出去,而拥有假的人有一半的概率买出去,每买出去一个会给自己的点贡献1的价值. 问题是…
每日CF: 411div2 Solved A CodeForces 805A Fake NP Solved B CodeForces 805B 3-palindrome Solved C CodeForces 805C Find Amir Solved D CodeForces 805D Minimum number of steps Attempted E CodeForces 805E Ice cream coloring     F CodeForces 805F Expected dia…
A. Fake NP time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.…
来自FallDream的博客,未经允许,请勿转载,谢谢. 由于人傻又菜 所以这次又滚去div2了  一堆结论题真的可怕 看见E题不是很有思路   然后就去大力搞F题  T了最后一个点 真的绝望   但是还是上紫了 感觉每次cf都在乱打 我好菜啊都不会 A.Fake NP 给定l和r,求[l,r]中的数的因数中出现次数最多的那一个 sb题 如果l和r相同输出它 不然输出2 #include<iostream> #include<cstdio> #include<cstring&…
A. Fake NP 题意:给你l,r,让你输出[l,r]里面除1以外的,出现因子数量最多的那个数. 题解:如果l==r输出l,否则都输出2 #include<bits/stdc++.h> using namespace std; int main(){ int l,r; cin>>l>>r; if(r-l==0){ cout<<l<<endl; return 0; } int ans = 0; int num = 0; for(int i=2;…
比赛时候切了A-E,fst了A Standings第一页只有三个人挂了A题,而我就是其中之一,真™开心啊蛤蛤蛤 A. Fake NP time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak…
A. Fake NP 题意:询问一个区间[L,R]出现次数最多的正整数因子(>1). 一个区间内一个因子P出现次数大概为[R/P]-[(L-1)/P],约等于(R-L+1)/P,P取2时最优.注意L=R时,且L为奇数输出L即可. B. 3-palindrome 题意:要求用'a','b','c'组成长度为n的字符串,并且没有长度为3的回文串,还要使‘c’出现次数最少. 没有长度为3的回文串,等于没有长度为奇数(>1)的回文串.直接循环输出aabbaabb..... C. Find Amir 题…
codeforces 805A     http://codeforces.com/problemset/problem/805/A /* 题意:输入两个整数l,r,让你找一个因子 使得[l,r]里面所有的数,能整除这个因子的数最多,输出这个因子 如果答案有多个,输出任意一个 */ #include<iostream> #include<cstdio> #include<cstring> using namespace std; int l,r,cnt1,cnt2; i…
A Fake NP standard input/output s, MB Submit Add to favourites x3673 B -palindrome standard input/output s, MB Submit Add to favourites x3760 C Find Amir standard input/output s, MB Submit Add to favourites x3503 D Minimum number of steps standard in…
A. Fake NP time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.…
1. 从纳什均衡(Nash equilibrium)说起 我们先来看看纳什均衡的经济学定义: 所谓纳什均衡,指的是参与人的这样一种策略组合,在该策略组合上,任何参与人单独改变策略都不会得到好处.换句话说,如果在一个策略组合上,当所有其他人都不改变策略时,没有人会改变自己的策略,则该策略组合就是一个纳什均衡. B站上有一个关于”海滩2个兄弟卖雪糕“形成纳什均衡的视频,讲的很生动. 不管系统中的双方一开始处于什么样的状态,只要系统中参与竞争的个体都是”理性经济人“,即每个人在考虑其他人的可能动作的基…
数据集是10000个样本,前8000个训练集,后面的用来测试.每个样本是1*144(重构成12*12的矩阵),将原始BiGAN有编码器.判别器和生成器,将里面的全连接层全部替换成了卷积. from __future__ import print_function, division from keras.datasets import mnist from keras.layers import Input, Dense, Reshape, Flatten, Dropout, multiply,…
最近看到keras的官方GAN代码中有CGAN(全连接层)和卷积GAN(DCGAN),但他并没有给出“条件卷积GAN”,预测就把这两者结合了一下.虽然很多人用其他框架(e.g.TensorFlow)写出了条件卷积GAN,但代码没有keras简洁,作为keras爱好者,就做了简单地结合就完成了. from __future__ import print_function, division from keras.datasets import mnist from keras.layers imp…
第一个GAN模型-生成手写数字 一.GAN的基础:对抗训练 形式上,生成器和判别器由可微函数表示如神经网络,他们都有自己的代价函数.这两个网络是利用判别器的损失记性反向传播训练.判别器努力使真实样本输入和伪样本输入带来的损失最小化,而生成器努力使它生成的为样本造成的判别器损失最大化. 训练数据集决定了生成器要学习模拟的样本类型,例如,目标是生成猫的逼真图像,我们就会给GAN提供一组猫的图像. 用更专业的术语来说,生成器的目标是生成符合训练数据集数据分布的样本.对计算机来说,图像只是矩阵:灰度图是…
深度卷积生成对抗网络(DCGAN) 我们在第3章实现了一个GAN,其生成器和判别器是具有单个隐藏层的简单前馈神经网络.尽管很简单,但GAN的生成器充分训练后得到的手写数字图像的真实性有些还是很具说服力的.即使是那些无法被识别为人类手写数字的字符,也具有许多手写符号的特征,例如可辨认的线条边缘和形状,特别是与用作生成器原始输入的随机噪声相比,更是如此. 想象一下,如果使用更强大的网络架构可以实现什么?本章中的生成器和判别器都将使用卷积神经网络(CNN,或 ConvNet),而不再是简单的双层前馈网…
半监督生成对抗网络 一.SGAN简介 半监督学习(semi-supervised learning)是GAN在实际应用中最有前途的领域之一,与监督学习(数据集中的每个样本有一个标签)和无监督学习(不使用任何标签)不同,半监督学习只为训练数据集的一小部分提供类别标签.通过内化数据中的隐藏结构,半监督学习努力从标注数据点的小子集中归纳,以有效地对从未见过的新样本进行分类,要使半监督学习有效,标签数据和无标签数据必须来自相同的基本分布. 缺少标签数据集是机器学习研究和实际应用中的主要瓶颈之一,尽管无标…
B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/556/problem/B Description Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famou…
题目传送门 /* 题意:n个数字转盘,刚开始每个转盘指向一个数字(0~n-1,逆时针排序),然后每一次转动,奇数的+1,偶数的-1,问多少次使第i个数字转盘指向i-1 构造:先求出使第1个指向0要多少步,按照这个次数之后的能否满足要求 题目读的好累:( */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath>…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, pu…
题目链接:http://codeforces.com/problemset/problem/556/B 题目意思:给出 n 个齿轮,每个齿轮有 n 个 teeth,逆时针排列,编号为0 ~ n-1.每按一次 button,每个齿轮都会有且仅有一个活动的tooth,对于偶数编号的齿轮,它下一个活动tooth是紧挨着当前tooth的逆时针方向的那个:而奇数编号的齿轮,下一个活动tooth是顺时针的那个.给出每个齿轮的活动tooth,问通过按下有限次的button,问能不能得到一个0,1,...,n-…
/////////////////////////////////////////////////////////////////////////////////////////////////////// 作者:stxy-ferryman声明:本文遵循以下协议自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0 查看本文更新与讨论请点击:http://www.cnblogs.com/stxy-ferryman/链接被删请百度:stxy-ferryman…
B. Case of Fake Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of…