找规律
爱上键盘的小哥哥
这个作者很懒,什么都没留下…
展开
-
好数
有n个数 a ,a ,...,a 开始都是0现在进行操作 t从1~n依次增加每次把下标时t的倍数的数都反转(0变成1,1变成0) 如果最后a 为0,那么称此时的i为好数。现在对于给定的n,求这时候的好数个数。nInput 一个数n,表示有n个数。(nOutput 一个数,表示好数的个数。 Sample Input 2Sample Output 1原创 2017-08-22 21:22:31 · 603 阅读 · 0 评论 -
阿牛的EOF牛肉串
今年的ACM暑期集训队一共有18人,分为6支队伍。其中有一个叫做EOF的队伍,由04级的阿牛、XC以及05级的COY组成。在共同的集训生活中,大家建立了深厚的友谊,阿牛准备做点什么来纪念这段激情燃烧的岁月,想了一想,阿牛从家里拿来了一块上等的牛肉干,准备在上面刻下一个长度为n的只由"E" "O" "F"三种字符组成的字符串(可以只有其中一种或两种字符,但绝对不能有其他字符),阿牛同时禁止在串中出现原创 2017-08-23 15:10:47 · 164 阅读 · 0 评论 -
Table
Simon has a rectangular table consisting of n rows andm columns. Simon numbered the rows of the table from top to bottom starting from one and the columns — from left to right starting from one. We'原创 2017-08-31 09:57:22 · 195 阅读 · 0 评论 -
Parade (规律)
Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even kno原创 2017-08-31 15:23:43 · 525 阅读 · 0 评论 -
Print Check
Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a printer that will be able to print horizontal and vertical strips. First proto原创 2017-09-29 10:30:07 · 548 阅读 · 0 评论 -
B - Grandma Laura and Apples
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.She precisely re原创 2017-10-02 18:02:54 · 243 阅读 · 0 评论 -
Eddy's AC难题
Eddy是个ACMer,他不仅喜欢做ACM题,而且对于Ranklist中每个人的ac数量也有一定的研究,他在无聊时经常在纸上把Ranklist上每个人的ac题目的数量摘录下来,然后从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组中的最大ac数,但是这样的情况会有很多,聪明的你知道这样的情况有多少种吗?特别说明:为了问题的简化,我们这里假设原创 2017-11-08 20:08:27 · 388 阅读 · 0 评论 -
Xiao Ming's Hope
Xiao Ming likes counting numbers very much, especially he is fond of counting odd numbers. Maybe he thinks it is the best way to show he is alone without a girl friend. The day 2011.11.11 comes. Seein原创 2017-11-08 20:46:14 · 206 阅读 · 0 评论 -
做题的方式简单点
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string ofn原创 2017-10-31 20:07:04 · 321 阅读 · 0 评论 -
Game of Robots
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from1 to 109.At some moment, robots decided to play the game "Snowball"原创 2017-11-12 19:37:29 · 277 阅读 · 0 评论 -
Misha and Changing Handles
Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle t原创 2017-11-12 20:22:45 · 158 阅读 · 0 评论 -
Magic Box
One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges原创 2017-11-28 17:08:24 · 276 阅读 · 0 评论 -
月之数(HDU2502)
Problem Description当寒月还在读大一的时候,他在一本武林秘籍中(据后来考证,估计是计算机基础,狂汗-ing),发现了神奇的二进制数。如果一个正整数m表示成二进制,它的位数为n(不包含前导0),寒月称它为一个n二进制数。所有的n二进制数中,1的总个数被称为n对应的月之数。例如,3二进制数总共有4个,分别是4(100)、5(101)、6(110)、7(111),他们中1的原创 2017-12-25 21:14:42 · 195 阅读 · 0 评论 -
又见GCD(DDU2504)
Problem Description有三个正整数a,b,c(0 Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。 Output输出对应的c,每组测试数据占一行。 Sample Input26 212 4 Sample Output48分析:C一定是最大原创 2017-12-25 21:45:44 · 165 阅读 · 0 评论 -
Tiling_easy version
Problem Description有一个大小是 2 x n 的网格,现在需要用2种规格的骨牌铺满,骨牌规格分别是 2 x 1 和 2 x 2,请计算一共有多少种铺设的方法。 Input输入的第一行包含一个正整数T(T Output输出一共有多少种铺设的方法,每组数据的输出占一行。 Sample Input32812原创 2017-12-25 22:19:43 · 452 阅读 · 0 评论 -
我是菜鸟,我怕谁(前缀和)
Problem Descriptionlin2144是一只小菜鸟,都是笨鸟先飞,lin2144想来个菜鸟先飞,他从0点出发一开始的飞行速度为1m/s,每过一个单位时间lin2144的飞行速度比上一个单位时间的飞行速度快2m/s,问n (0 Input输入一个T表示为有几组数据每组数据输入一个n,表示lin2144飞行的时间. Output输出l原创 2017-12-27 21:12:15 · 342 阅读 · 0 评论 -
反素数
Problem Description反素数就是满足对于任意i(0 Input第一行输入n,接下来n行测试数据输入包括a,b, 1 Output输出为一个整数,为该区间因子最多的数.如果满足条件有多个,则输出其中最小的数. Sample Input32 31 1047 359 Sample Output原创 2017-12-27 22:29:02 · 338 阅读 · 0 评论 -
矩形A + B
Problem Description给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格. Input第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n Output每行输出网格中有多少个矩形. Sample Input21 22 4 Sa原创 2017-12-28 09:14:02 · 558 阅读 · 0 评论 -
G - Permute Digits
You are given two positive integer numbers a andb. Permute (change order) of the digits ofa to construct maximal number not exceedingb. No number in input and/or output can start with the digit原创 2018-01-22 20:24:52 · 236 阅读 · 0 评论 -
Pairwise Sum and Divide
有这样一段程序,fun会对整数数组A进行求值,其中Floor表示向下取整:fun(A) sum = 0 for i = 1 to A.length for j = i+1 to A.length sum = sum + Floor((Ai+Aj)/(Ai*Aj)) return sum给出数原创 2018-01-23 10:24:48 · 286 阅读 · 0 评论 -
Another Problem on Strings
A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in stringw. For exam原创 2018-01-23 21:36:40 · 245 阅读 · 0 评论 -
数字1的数量
给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数。例如:n = 12,包含了5个1。1,10,12共包含3个1,11包含2个1,总共5个1。 Input 输入N(1 Output 输出包含1的个数 Sample Input 12Sample Output 5大牛:点击打开链接代码:#include#includeusing nam原创 2018-01-23 16:34:43 · 211 阅读 · 0 评论 -
骨牌覆盖
在2*N的一个长方形方格中,用一个1*2的骨牌排满方格。问有多少种不同的排列方法。例如:2 * 3的方格,共有3种不同的排法。(由于方案的数量巨大,只输出 Mod 10^9 + 7 的结果)Input 输入N(N Output 输出数量 Mod 10^9 + 7 Sample Input 3Sample Output 3#include#inclu原创 2018-01-24 10:33:07 · 295 阅读 · 0 评论 -
Appleman and Card Game
Appleman has n cards. Each card has an uppercase letter written on it. Toastman must choosek cards from Appleman's cards. Then Appleman should give Toastman some coins depending on the chosen cards.原创 2018-01-27 10:15:02 · 198 阅读 · 0 评论 -
Filya and Homework CodeForces - 714B
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.Filya is given an array of non-negative integers a1, a2原创 2018-02-04 20:39:12 · 127 阅读 · 0 评论 -
911A. Nearest Minimums(暴力+思维)
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times....原创 2018-02-26 10:29:03 · 361 阅读 · 0 评论 -
B. Two Cakes(思维+暴力)
It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one...原创 2018-02-26 11:52:31 · 1144 阅读 · 0 评论 -
911C. Three Garlands(思维)
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.When a garland is switched on, it periodica...原创 2018-02-26 12:49:58 · 835 阅读 · 0 评论 -
CodeForces - 908C New Year and Curling
Carol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She then will slide the disks towards the line y = 0 o原创 2018-01-30 13:55:01 · 130 阅读 · 0 评论 -
Complete the Word CodeForces - 716B
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears e...原创 2018-02-12 10:21:12 · 158 阅读 · 0 评论 -
922C - Cave Painting
Imp is watching a documentary about cave painting. Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of ...原创 2018-02-12 15:54:30 · 395 阅读 · 0 评论 -
920A. Water The Garden
It is winter now, and Max decided it's about time he watered the garden.The garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located...原创 2018-02-12 20:21:38 · 631 阅读 · 0 评论 -
920B. Tea Queue
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, n...原创 2018-02-12 20:47:43 · 235 阅读 · 0 评论 -
897B. Chtholly's request
— Thanks a lot for today.— I experienced so many great things.— You gave me memories like dreams... But I have to leave now...— One last request, can you...— Help me solve a Codeforces problem?— .......原创 2018-03-06 18:51:48 · 160 阅读 · 0 评论 -
898A. Rounding
Vasya has a non-negative integer n. He wants to round it to nearest integer, which ends up with 0. If n already ends up with 0, Vasya considers it already rounded.For example, if n = 4722 answer is 47...原创 2018-03-06 19:00:40 · 167 阅读 · 0 评论 -
898B. Proper Nutrition(思维)
Vasya has n burles. One bottle of Ber-Cola costs a burles and one Bars bar costs b burles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars...原创 2018-03-06 19:12:40 · 255 阅读 · 0 评论 -
920C. Swap Adjacent Elements
You have an array a consisting of n integers. Each integer from 1 to n appears exactly once in this array.For some indices i (1 ≤ i ≤ n - 1) it is possible to swap i-th element with (i + 1)-th, for ot...原创 2018-02-12 22:20:54 · 239 阅读 · 0 评论 -
919C. Seat Arrangements
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and y...原创 2018-02-13 21:27:02 · 317 阅读 · 0 评论 -
Jamie and Alarm Snooze(暴力+思维)
Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He w...原创 2018-02-14 10:54:31 · 275 阅读 · 0 评论 -
916C. Jamie and Interesting Graph(构图+思维)
Jamie has recently found undirected weighted graphs with the following properties very interesting: The graph is connected and contains exactly n vertices and m edges. All edge weights are integers a...原创 2018-02-14 19:06:14 · 482 阅读 · 0 评论