
编程
文章平均质量分 60
冒牌嘚小冬瓜
I'm nobody now, but,I''ll be somebody in the future每个人都有一个梦,我也有,所以,朝着要实现自己的那个梦的方向出发吧,我年轻我怕谁,This is me!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Buy Tickets
Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Cat sti原创 2016-04-04 16:30:42 · 439 阅读 · 0 评论 -
Fire Again
Description input input.txt output output.txt After a terrifying forest fire in Berland a forest rebirth program was carried out. Due to it N rows with M trees each were planted and the rows were原创 2015-11-15 10:34:43 · 846 阅读 · 0 评论 -
Warehouse
Description input input.txt output output.txt Once upon a time, when the world was more beautiful, the sun shone brighter, the grass was greener and the sausages tasted better Arlandia was the mos原创 2015-11-15 20:14:45 · 536 阅读 · 0 评论 -
Company Income Growth
Description Petya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 (the year of its founding) till now. Petya原创 2015-11-25 10:33:24 · 904 阅读 · 0 评论 -
Extra-terrestrial Intelligence
Description input input.txt output output.txt Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signals’ receiver and was keeping a record原创 2015-11-15 10:54:36 · 693 阅读 · 0 评论 -
Shell Game
Description input input.txt output output.txt Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The原创 2015-11-15 10:58:08 · 774 阅读 · 0 评论 -
Chess
Description Two chess pieces, a rook and a knight, stand on a standard chessboard 8 × 8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other原创 2015-11-15 10:47:44 · 491 阅读 · 0 评论 -
Blinds(百叶窗)
Description The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in t原创 2015-11-16 12:55:07 · 447 阅读 · 0 评论 -
母牛的故事
斐波那契数列 先普及一下基础知识1.定义斐波那契数列,又称黄金数列,指的是这样一个数列:0、1、1、2、3、5、8、13、21、……在数学上,斐波纳契数列以如下被以递归的方法:F0=0,F1=1,Fn=F(n-1)+F(n-2)(n>=2,n∈N*).2.通项公式斐波那契数列:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55,原创 2015-02-11 10:27:07 · 577 阅读 · 0 评论 -
数学函数<math.h>
数学函数,拿你该怎么办 先看一下能在编程中用到数学函数的情况 int abs(int i) 返回整型参数i的绝对值 double cabs(struct complex znum) 返回复数znum的绝对值 double fabs(double x) 返回双精度参数x的绝对值 long labs(long n) 返回长整型参数n的绝对值 double exp(double x) 返回指数原创 2015-02-14 15:24:13 · 1090 阅读 · 0 评论 -
并查集中的最小生成树
最小生成树————结构体 + 并查集 给一个例题:Constructing Roads Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other.原创 2015-07-19 20:47:48 · 535 阅读 · 0 评论 -
Geometry Made Simple
Geometry Made SimpleDescriptionMathematics can be so easy when you have a computer. Consider the following example. You probably know that in a right-angled triangle, the length of the three sides a, b原创 2015-02-13 21:51:39 · 785 阅读 · 0 评论 -
递增
Description给你N个数,分别为a1,a2…aN,你现在可以交换两个数(只有一次机会),问你是否可以使这个序列成为递增序列。 即x1 <= X2 <= X3 <= X4.你只有一次交换机会,也可以选择不交换。Input输入包含多组测试用例,对于每组测试用例。 输入N(1 <= N <= 100000) 接下来输入N个数ai(0 <= ai <= 100000)。Output最多交换两个原创 2015-06-13 08:19:29 · 1000 阅读 · 1 评论 -
重复出现的数字
Input输入有多组测试用例,对于每组测试用例: 输入一个整数N(N <= 106),随后输入N个整数Ni(0 < Ni <= 104)Output输出出现次数最多的数字和对应次数,如果出现次数最多的数有多个,输出数字最大的那个。Sample Input5 1 1 2 2 3 5 1 2 3 4 4 Sample Output2 2 4 2#include <stdio.h>#incl原创 2015-06-16 15:08:41 · 1236 阅读 · 0 评论 -
并查集
这几天练习了并查集,解决多个集合问题。。 下面给一下模板int tp[1000];void init(){ for(int i = 1; i <= 100; i++) tp[i] = i; //初始化}int find(int x){ int t = x; while(t != tp[t])//找根节点原创 2015-07-19 20:44:09 · 448 阅读 · 0 评论 -
printf()问题
今天解决了一个很早以前就纠结的问题,a = 1 ,print(“%d %d\n”, a++, a++) 到底输出啥? 也百度了好多,也看了他们的博客,自己也总结了一下,但也只是知道为什么,但是深入讲解还是不行,先看一下专业人士的汇编代码:11: int a = 5;00401078 mov dword ptr [ebp-4],512: int b原创 2015-10-31 21:17:51 · 613 阅读 · 0 评论 -
解决那道不知道怎么错了的题————Conversions
大家是否还记得我在前面发表过的一篇文章,就是一道题,觉得很简单,但是自己运行的都对,提交就不对,我终于知道是怎么回事了,让我来告诉你们真相吧。原来是题目有点问题,数据有点问题,说白了,就是输入N之后,不是接着跟N组数据,而是大于或者小于或者等于,是不是。。。。。。再看一下我提交后的正确的代码吧#include#include int main(){ int n, i; char a原创 2015-02-13 08:31:50 · 765 阅读 · 0 评论 -
广搜1—— Meteor Shower(流星雨)
Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her原创 2015-11-27 18:57:40 · 496 阅读 · 0 评论 -
广搜2 —— Red and Black
Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles.原创 2015-11-27 19:04:48 · 464 阅读 · 0 评论 -
CA Loves Stick
Problem Description CA loves to play with sticks. One day he receives four pieces of sticks, he wants to know these sticks can spell a quadrilateral.Input First line contains T denoting the number o原创 2016-04-03 19:12:07 · 1155 阅读 · 0 评论 -
Billboard
Description 在学校的入口处有一个巨大的矩形广告牌,高为h,宽为w。所有种类的广告都可以贴,比如ACM的广告啊,还有餐厅新出了哪些好吃的,等等。。在9月1号这天,广告牌是空的,之后广告会被一条一条的依次贴上去。每张广告都是高度为1宽度为wi的细长的矩形纸条。贴广告的人总是会优先选择最上面的位置来帖,而且在所有最上面的可能位置中,他会选择最左面的位置,而且不能把已经贴好的广告盖住。如果没有原创 2016-04-03 19:00:22 · 387 阅读 · 0 评论 -
I Hate It
Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0#include <stdio.h原创 2016-04-01 18:08:22 · 311 阅读 · 0 评论 -
敌兵布阵
Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研原创 2016-04-01 18:01:26 · 383 阅读 · 0 评论 -
Autocomplete代码的修改
这道题在大神的帮助下终于找到错误了,原来是比较函数写错了。 改过后的代码#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;struct xx{ char qq[101];}x[101];int cmp(const void *x, const void *y){原创 2015-12-27 18:38:42 · 534 阅读 · 0 评论 -
Cola
Description To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is原创 2015-12-09 10:54:06 · 579 阅读 · 0 评论 -
Indian Summer
Description Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn’t take a leaf i原创 2015-12-07 11:29:07 · 816 阅读 · 2 评论 -
Martian Dollar
Description One day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equ原创 2015-12-07 11:00:20 · 919 阅读 · 0 评论 -
Guilty — to the kitchen!
Description It’s a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This s原创 2015-12-07 09:53:42 · 772 阅读 · 0 评论 -
Autocomplete
Description Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new原创 2015-12-22 20:13:29 · 1012 阅读 · 0 评论 -
深搜1 —— Prime Ring Problem
Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the n原创 2015-12-05 09:25:00 · 369 阅读 · 0 评论 -
四级Over
四级终于考完了,哎,大石头也着地了,那接下来的一周好好准备一下期末考试吧,也不知道考的怎么样,估计只要听力不是太狠差就差不多了,求过啊,就过啊,要不然就让我差很多,要不然就让我过,千万不要让我差几分! 完事,好好的复习吧,整理好心情,新装出发,Fighting! ————致路上的自己原创 2015-12-19 18:01:54 · 420 阅读 · 0 评论 -
Right Triangles
Description You are given a n × m field consisting only of periods (‘.’) and asterisks (‘‘). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are i原创 2015-12-18 11:23:27 · 570 阅读 · 0 评论 -
Choosing Symbol Pairs
Description There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1 ≤ i, j ≤ NS[i] = S[j], that is the i-th symbol of strin原创 2015-12-18 09:36:15 · 669 阅读 · 0 评论 -
广搜4 ——Cheese
Description 問題今年も JOI 町のチーズ工場がチーズの生産を始め,ねずみが巣から顔を出した.JOI 町は東西南北に区画整理されていて,各区画は巣,チーズ工場,障害物,空き地のいずれかである.ねずみは巣から出発して全てのチーズ工場を訪れチーズを 1 個ずつ食べる.この町には,N 個のチーズ工場があり,どの工場も1種類のチーズだけを生産している.チーズの硬さは工場によって異なっており,硬原创 2015-11-27 19:18:11 · 440 阅读 · 0 评论 -
广搜3 ——Property Distribution
Description タナカ氏が HW アールの果樹園を残して亡くなりました。果樹園は東西南北方向に H×W の区画に分けられ、区画ごとにリンゴ、カキ、ミカンが植えられています。タナカ氏はこんな遺言を残していました。果樹園は区画単位でできるだけ多くの血縁者に分けること。ただし、ある区画の東西南北どれかの方向にとなりあう区画に同じ種類の果物が植えられていた場合は、区画の境界が分からないのでそれらは原创 2015-11-27 19:08:39 · 389 阅读 · 0 评论 -
字符串的输出处理
我对字符串的输出是比较头疼的,就是在技巧方面把握的不好,记得刚开始接触字符串的时候,就是要正着输入倒着输。。。。。。都不会,就是找不到技巧,下面我会从简单到复杂分析一下这种题型,可能不全,请见谅。一.先说一下题意,就是随便输入一句话如“hello my friend”,输出的时候是“dneirf ym olleh”,大家看出什么了没有,就是正着输入,倒着输出,先看一下主要的代码内容吧.#inclu原创 2015-02-14 15:37:23 · 816 阅读 · 0 评论 -
轻松搞定素数
素数判定 素数,我们在数学上早就学过了吧,还记得定义是什么吗,其定义是:一个大于1的自然数,除了1和它本身外,不能整除以其他自然数(质数)整除,素数又叫质数。我们在进行素数判定的时候就要从它的定义入手。我们先来看一道例题。素数判定Description 对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39<=x#include<stdio.h>int main(原创 2015-02-14 15:43:20 · 598 阅读 · 0 评论 -
教你如何求多项式的系数
在数学书我们曾经学过求多项式系数的问题吧,但是编程上怎么办呢?先给一道例题看看吧 Easy TaskCalculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))’ to denote its derivation. We use x^n to denote xn.原创 2015-02-14 15:56:29 · 8770 阅读 · 0 评论 -
似兄弟的排列与组合
大家还记得我们在高中或者是在初中(具体什么时候忘记了)的时候在数学上学的排列与组合吗?记得那时候我的数学老师非得让我们把排列与组合的定义背的滚瓜烂熟的,但是,我到现在也背不上来,如今,在编程上又让我们相见,哈哈,缘分呐! 现在,就让我们一起回顾一下什么叫作排列,什么叫作组合吧。 1.排列 定义:在数学上——从n个不同元素中,任取m(m≤n,m与n均为自然数,下同)个元素按照一定的顺序排成一列,原创 2015-02-16 20:17:22 · 717 阅读 · 0 评论 -
水仙花数
水仙花数这道题相比较是简单的,因为我水平一般般,所以,我不能说它是水题,这道题就是要把个位,十位,百位表示出来就哦了,所以,这也算的上是一种技巧题吧。记得曾经做的时候不知道怎么表示,而我那位学长就轻易的知道该怎么下手了,我就问他怎么找到这种思路的,他说就是做题做的比较多吧,就自然的产生了“语感”,就像学习语文和英语一样,语感。话不多说了,让我们看一下题吧!水仙花数Description 春天是鲜花原创 2015-02-19 07:17:48 · 2192 阅读 · 0 评论