![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
WOJ
文章平均质量分 77
暴走777
菜鸟一个
展开
-
WOJ:Starter:1046 - BONUS#4 - 统计字符
gets()函数不能控制输入的长度,例如 char str[100]; gets(str); 如果用户输入10000个字符,情况会怎样呢?很显然,数组越界,程序很可能会崩溃,并且还有受到恶意输入导致遭受溢出攻击的风险。可用的替代函数是 fgets, 原型类似于 char * fgets(const char *str, unsigned maxlen, FILE *f原创 2016-08-20 09:55:13 · 841 阅读 · 0 评论 -
WOJ:Starter:1052 - BONUS#A - 全排列
下面的代码主要是用了快速排列函数qsort用其排序还是很方便的#include #include #include /* 学习库函数qsort*/int cmp(const void *a, const void *b) { return *(char *)a - *(char *)b;//从小到大,反之,从大到小 }int main() {原创 2016-08-20 10:03:15 · 702 阅读 · 0 评论 -
WOJ1103-Littleken
littleken和computer下象棋,胜者得一分,当一方的分数比另一方多2时。则算胜利,已知littleken下一局胜的概率是P。求最后littleken胜的概率。 输入格式首先是一个整数T(输出格式Littleken最终胜的概率。用%号来表示,并保2位小数。样例输入150%样例输出50.00%设f[i]表示当前有i分,赢得游戏的概原创 2017-09-03 18:46:18 · 1364 阅读 · 0 评论 -
WOJ1106-String's Puzzle
Zhu Ming and Small Li find a strange stone tablet, which has some capitals printed on it. Capitals in every string are different with each other, and every capital string is followed by a number. Beca原创 2017-09-03 19:01:51 · 642 阅读 · 0 评论 -
WOJ1110-Frame Stacking
Consider the following 5 picture frames placed on an 9 x 8 array. ........ ........ ........ ........ .CCC.... EEEEEE.. ........ ........ ..BBBB.. .C.C.... E....E.. DDDDDD.. ........ ..B..B..原创 2017-09-03 19:05:26 · 1224 阅读 · 0 评论 -
WOJ1123-Bishops
KO learned the rules of chess and defeated his father, all his friends, his little brother, and now no one wants to play with him any more. And so he plays with himself, that is, he often asks some原创 2017-09-03 19:07:24 · 522 阅读 · 0 评论 -
WOJ1124-Football Coach
It is not an easy job to be a coach of a football team. The season is almost over, only a few matches are left to play. All of sudden the team manager comes to you and tells you bad news: the main s原创 2017-09-03 19:09:45 · 1012 阅读 · 0 评论 -
WOJ1064-What is Left
My lovely sister QingQing has many books. One day she numbers her books with integer. Of cause same books are marked bythe same number. When all the books are marked, it is easy to find how many are原创 2017-09-01 16:34:37 · 1335 阅读 · 1 评论 -
WOJ1138-Gauss Fibonacci
Without expecting, Angel replied quickly.She says: "I'v heard that you'r a very clever boy. So if you wanna me be your GF, you should solve the problem called GF~. " How good an opportunity that转载 2017-09-03 20:11:40 · 535 阅读 · 0 评论 -
WOJ1119-Model Rocket Height
One method for determining the height achieved by a model rocket is to have three observers A, B and C equally spaced D feet apart along a line at one edge of the flat test field. Each observer has原创 2017-09-03 19:43:31 · 1305 阅读 · 0 评论 -
WOJ1137-Flowers
As you know, Gardon trid hard for his love-letter, and now he's spending too much time on choosing flowers for Angel. When Gardon entered the flower shop, he was frightened and dazed by thousands ki原创 2017-09-03 20:09:36 · 1151 阅读 · 0 评论 -
WOJ1133-Candies
KO loves candies. Most of all, he likes chocolate, strawberry and banana flavored ones. Now, he has N bags full of candies, each bag contains some candies of all three flavors. KO knows the number o原创 2017-09-03 19:57:48 · 1380 阅读 · 0 评论 -
WOJ1115-An Excel-lent Problem
A certain spreadsheet program labels the columns of a spreadsheet using letters. Column 1 is labeled as A", column 2 asB", ..., column 26 as Z". When the number of columns is greater than 26, anot原创 2017-09-03 19:39:12 · 1277 阅读 · 0 评论 -
WOJ1107-DNA
It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters,A, C, G, and T. Biologists have been interested in iden原创 2017-09-04 20:29:52 · 1545 阅读 · 0 评论 -
WOJ1134-Card Game
Adam and Eve play a card game using a regular deck of 52 cards. The rules are simple. Theplayers sit on opposite sides of a table, facing each other. Each player gets k cards from thedeck and,原创 2017-09-04 20:32:53 · 1235 阅读 · 0 评论 -
WOJ1141-Encoded Love-letter
After Gardon had got Angel's letter, he found it was encoded...Oh my god, why did she encode a love-letter?? But don't worry, she wrote thealgorithm for encoding after the letter: Each charactor原创 2017-09-04 20:37:21 · 641 阅读 · 0 评论 -
WOJ1142-Half of and a Half
Gardon bought many many chocolates from the A Chocolate Market (ACM). When he was on the way to meet Angel, he met Speakless by accident."Ah, so many delicious chocolates! I'll get half of them an原创 2017-09-04 20:43:42 · 453 阅读 · 0 评论 -
WOJ1152-Feli的糖果
Ader给Felicia寄来了很多很多的好吃的糖果,Felicia给每一个糖果标记了一个可口度,每天从中选出第K好吃的糖果来吃,但是,Ader寄来的糖果实在是太多太多了,编号后也只能一股脑的放在一个盒子里,Felicia每天都要花巨量的时间来找糖果,这显然是一件折磨人的事,他想写个程序来解决这个问题,但是,万恶的期末考就要来临,Felicia不得不复习E文,只好拜托你来解决这个问题啦!原创 2017-09-04 20:46:37 · 781 阅读 · 0 评论 -
WOJ1157-Easy to Count
There are N boxes on one straight line which is long enough. They move at the same speed, but their directions may be different. That is, some boxesmay move left, while the others move right. As原创 2017-09-04 20:48:26 · 1213 阅读 · 0 评论 -
WOJ1143-Part-time Job
Snoopy lost his wallet, but he is afraid to tell his family, so he decided to do a part-time job to earn money in weekends. He is sellingwashing machines in a big market, he will get p dollars by原创 2017-09-04 20:55:57 · 1109 阅读 · 0 评论 -
WOJ1165-Smith Number
1982年,Lehigh大学的数学家Albert Wilansky在查看电话簿的时候,突然发现他的姐夫H.Smith的电话号码有一个很特别的性质:该数字的所有位数之和,等于该数所有质因子的位数之和4937775 = 3 * 5 * 5* 65837 4937775的位数和为: 4+9+3+7+7+7+5 = 42 而该数所有质因子的位数之和为: 3+5+5+(6+5+8+3原创 2017-09-04 20:58:47 · 754 阅读 · 0 评论 -
WOJ1166-Is There Any Prefix?
给定一组二进制串,判断是否其中有一串是另外某一串的前缀。对于两个相同的串,我们规定两串相互不为前缀。 例如:10, 010, 0100, 0010, 1010 其中,10是1010的前缀 输入格式输入有多组数据,每一组数据的第一行为一个整数N,接下来为N个二进制串,每一个串一行。每个二进制串最少有一个比特,而最多有10个比特。每两组输入间有一行空格。N=0时程序结束。输原创 2017-09-04 21:00:45 · 342 阅读 · 0 评论 -
WOJ1167-Oil Detecting
石油公司在某地开采石油,他们把地面(长方形)分成一个个的小正方形,然后逐个勘探,有的正方形探到了石油,而有的没有,如果有两个石油地是相连的(上下、左右、对角),则说明它们是同个石油点。现在,公司已经把所有的勘探点都勘探好了,他们请你写个程序计算一下到底有多少个不同的石油点。 输入格式第一个为两个整数r和c,表示地面的长和宽。下面为r行c列的字符矩阵,O表示该处有石油,X表示原创 2017-09-04 21:02:29 · 1298 阅读 · 0 评论 -
WOJ1154-A Simple Task
Alice's QQ is lost because she set a very simple password ?abcdefg?, her friend Bobtell her that a password like ?abcdefg? is too easy to guess, a good password is suggestto be at least 6 byte原创 2017-09-05 19:23:28 · 1149 阅读 · 0 评论 -
WOJ1170-Sorting
对一组输入的数据进行排序。 对输入的数据,我们有如下的约定:所有的输入数据都为正整数,且都不大于300000000。但是输入的数据可能会有重复,排序时,应将重复的数据合并,即同样的数只处理一次。输入格式只有一组数据,以0结尾。输出格式输出排序后的数据(不含0),其中相同的数应只显示1个。样例输入12500000 10000000 12500000 0样例原创 2017-09-05 19:25:44 · 697 阅读 · 0 评论 -
WOJ1171-Recursive Function
学了编程的,都对递归函数不陌生吧,那让我们看看下面这个递归函数W(a, b, c): 你闭着眼睛就能写出个递归函数来,那就试试看。。 输入格式第一行为整数N,接下来为N行测试数据,每行有三个整数a, b, c输出格式输出格式为W(a, b, c) = x。注意=号左右的空格和a, b, c间的空格!样例输入51 1 12 2 240 40 40原创 2017-09-05 19:30:01 · 388 阅读 · 0 评论 -
WOJ1187-Difference Minimizing
Ginger's supervisor Mr. Zhang has great interest in arithmetic; today, Mr. Zhang left her a problem, the last problem of IPRAI's 2nd Round GS-Examination. Can you help the poor little girl to find out原创 2017-09-05 19:31:53 · 469 阅读 · 0 评论 -
WOJ1162-Simple Addition
给两个数n1, n2,计算s = n1 + n2。很简单的算术题,不是吗?输入格式输入的第一行为整数N,表示测试数据的个数。接下来的N行,每行为两个非负整数,即上面的n1和n2。n1、n2的位数不会超过1000位,除0外没有数字以0开头(e.g. 0100, 0053)。输出格式对于每对n1、n2,输出一行结果:s=n1 + n2。样例输入33 290 1099999原创 2017-09-05 19:42:56 · 437 阅读 · 0 评论 -
WOJ1173-Josephus Permutation
假设有编号为1-n的n个人按编号由小到大顺时针围成一个圆圈,现在给定一个m。由一号开始,我们数m个人,然后将此人移出圆圈,然后又数m个人,再将此人移出??不断做下去,最后n个人都移出了圆圈。这样我们就得到了(n, m)-Josephus Permutation。例如:(7, 3)-Josephus Permutation为 输入格式每行为一个测试数据,一个测试数据为两个正整数,原创 2017-09-05 19:46:21 · 422 阅读 · 0 评论 -
WOJ1114-Bullseye
A simple dartboard consists of a flat, circular piece of cork with concentric rings drawn on it. Darts are thrown at the board by players inan attempt to hit the center of the dartboard (the Bulls原创 2017-09-05 19:49:56 · 1193 阅读 · 0 评论 -
WOJ1185-Apples
Little Ginger got an assignment from her teacher: how many ways are there to put 4 apples in 2 baskets. There are no differences between apples and baskets. It?s easy for Ginger to solve, since she ca原创 2017-09-05 19:58:55 · 1199 阅读 · 0 评论 -
WOJ1192-Image Conversion
How to convert a gray image into a binary image? Recently, Ginger is doing some research like that. Assume that each pixel in the gray image is represented by one unsigned byte value, which means that原创 2017-09-05 20:03:56 · 1140 阅读 · 0 评论 -
WOJ1184-Feli的糖果2
Feli有很多很多好吃的糖果,总共有n种,编号为1到n。一天flymouse,masnake,zercal,mmd,yama,cz等2*n个人一起去Feli家,flymouse一直觊觎Feli的糖果,于是flymouse趁Feli不注意偷偷从Feli的盒子里拿掉了n个糖果,每个糖果都不同种。Flymouse的这一小动作被masnake看到了,于是masnake把flymouse手里编号为2的倍数的原创 2017-09-05 20:25:26 · 1393 阅读 · 0 评论 -
WOJ1100 - Forest
题目链接:http://acm.whu.edu.cn/learn/problem/detail?problem_id=1100点击打开链接第一次做的时候有个名字打错了一个字母,被坑了一次,这种简单题一定要细心哦!#include#include#includeint main(){ int t,i,max,maxi,len; int count[10]; char s[原创 2016-09-11 21:00:40 · 1643 阅读 · 0 评论 -
WOJ1201-Circle
平面上有n个点。给你一个半径为r的圆,问最多能覆盖多少个点(圆周上的点能够被覆盖) 输入格式本题有多组测试数据,请处理到EOF 每组数据第一行有两个整数n,r,表示平面上点的个数和圆的半径。 0接下去n行每行有两个整数xi,yi,分别为n个点的坐标,-10000输出格式对每组输入,输出这个圆最多能覆盖多少个点 样例输入4 10 00 11 01 1样例输出原创 2017-09-06 09:53:01 · 1037 阅读 · 0 评论 -
WOJ1207-Feli的糖果3
Sherlcok要过生日,Felicia决定送他一份礼物。Feli拿出自己心爱的糖果,决定做一个糖果棒。大家都知道,Feli给他的糖果都划分了好吃的程度0~9,而糖果棒的好吃的程度就等于他所用的糖果所组成的数。等他做完糖果棒的身后,发现自己做的实在是不好看,他决定重做,他想把糖果棒做成左右对称的,但是他觉得整个棒子不能比原来还不好吃,然而要尽量花费小,于是他想请你帮他设计一下!假定Feli每种糖果原创 2017-09-06 09:58:21 · 774 阅读 · 0 评论 -
WOJ1208-Sherlock's Code
Sherlock Bourne is the best spy of CIA. He has two lists. Each of them has N integers, and he often encrypts his message by this rule: each time he picks one number from one list and pluses another nu原创 2017-09-06 10:01:28 · 823 阅读 · 0 评论 -
WOJ1202-找不同
给你n*2+1个数 其中有n对是一样的 让你找出单出来的那一个。输入格式只有一个测试数据 第一行,是一个整数n(n输出格式输出单出来的那个数样例输入1221样例输出1#includeint main(){ int n,i,j,res=0; scanf("%d",&n); for(i=0;i<2*n+1;i++原创 2017-09-06 10:04:25 · 704 阅读 · 0 评论 -
WOJ1203-找相同
有一组数,很多很多个数,里面有一个数出现了超过一半次,请你把它找出来输入格式先是一个N (N输出格式对每个Case,输出一行,这一行只含有一个在之前数列中出现超过一半次的数.样例输入115 5 5 5 5 5 1 2 3 4 6样例输出5#include#includeint main() { int n,i,k; while(scanf("%原创 2017-09-06 10:07:37 · 677 阅读 · 0 评论 -
WOJ1204-继续找相同
有 n 个整数, 其中有且仅有一个整数出现了 >= n/2.0 次 (n输入格式每组数据第一行是 n, 然后接下来一行是 n 个整数, 请读入到 EOF输出格式输出每行一个整数, 即要找的这个数样例输入95 5 5 5 5 1 2 3 4样例输出5#include#includeint num[500005];int main(){原创 2017-09-06 10:15:26 · 845 阅读 · 0 评论