time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probab…
题 题意 一升奶可以花费a元,也可以话b元买然后获得c元,一开始有n元,求最多买多少升奶. 分析 贪心,如果b-c<a,且n≥b,那就买b元的,n先减去b再看看够买多少瓶,然后再+1瓶,余款再购买a元的. 代码 #include<cstdio> unsigned long long n,a,b,c,ans; int main(){ scanf("%lld%lld%lld%lld",&n,&a,&b,&c); if(b-c<a &a…
实验七的目的是设计实现最大为99数字在2个数码管上.采用同步动态扫描.即行信号和列信号同步扫描.这里数码管是共阳极的.选择端口也是共阳极的. 模块: /************************************* module name: number_mod_module.v function: generate ten-bit and one-bit number. by yf.x 2014-11-11 *************************************…
题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制数字,求出其长len,当len为奇数时,第一位为1,后面的位数如果都为0,则输出len,如果有一个不为0,则输出len+1: 当len为偶数时,则输出len.(之所以这样输出是因为题目给定4的次幂是从0开始的) #include<iostream> #include<string> #…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land is famous with its apple trees grow…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output You are given an array of positive integers a1, a2, -, an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the l…
[题目链接]:http://codeforces.com/contest/758/problem/D [题意] 给你一个n进制的数k; 问你它可能的最小的十进制数是多少; [题解] 从右往左; 获取数字; 如果这个数字小于n就一直往左扩大; 尽量大; 这样把尽可能多的数字放在权值的低位; 这样n进制数的位就会尽可能地少; 十进制数也就尽可能地小了; 但是有前导0的情况; 这个判断前导0有点麻烦; 即 10011 你不好获取 0011这个数字的信息: 即是不是到了从右往左数第二个0的时候,就该停下…
[题目链接]:http://codeforces.com/contest/379/problem/D [题意] 让你构造出两个长度分别为n和m的字符串s[1]和s[2] 然后按照连接的规则,顺序连接s[n-2]和s[n-1]得到s[n] (n>=3) 即s[n] = s[n-2]+s[n-1] 以此规则得到s[k]; 要求s[k]恰好出现x个"AC"子串; [题解] 暴力题; 枚举s1有ac1个"AC"子串,s2有ac2个"AC"子串; 这…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output After seeing the "ALL YOUR BASE ARE BELONG TO US" meme for the first time, numbers X and Y realised that they have different bases, which co…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become a…