随笔分类 -  ACM算法

摘要:FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line 阅读全文
posted @ 2019-07-18 11:01 木子川 阅读(161) 评论(0) 推荐(0)
摘要:The cows play the child's game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes into which to hop, the cows create a 5 阅读全文
posted @ 2019-07-17 10:15 木子川 阅读(213) 评论(0) 推荐(0)
摘要:FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers t 阅读全文
posted @ 2019-07-16 17:53 木子川 阅读(207) 评论(0) 推荐(0)
摘要:Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some order. The 阅读全文
posted @ 2019-07-16 17:21 木子川 阅读(214) 评论(0) 推荐(0)
摘要:7 パズル 7 パズルは 8 つの正方形のカードとこれらのカードがぴたりと収まる枠で構成されています。それぞれのカードには、互いに区別できるように 0, 1, 2, ..., 7 と番号がつけられています。枠には、縦に 2 個、横に 4 個のカードを並べることができます。 7 パズルを始めるときには 阅读全文
posted @ 2019-07-15 16:17 木子川 阅读(108) 评论(0) 推荐(0)
摘要:チーズ () 問題 今年も JOI 町のチーズ工場がチーズの生産を始め,ねずみが巣から顔を出した.JOI 町は東西南北に区画整理されていて,各区画は巣,チーズ工場,障害物,空き地のいずれかである.ねずみは巣から出発して全てのチーズ工場を訪れチーズを 1 個ずつ食べる. この町には,N 個のチーズ工場 阅读全文
posted @ 2019-07-14 14:08 木子川 阅读(136) 评论(0) 推荐(0)
摘要:On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played o 阅读全文
posted @ 2019-07-13 13:59 木子川 阅读(278) 评论(0) 推荐(0)
摘要:図のように二股に分かれている容器があります。1 から 10 までの番号が付けられた10 個の玉を容器の開口部 A から落とし、左の筒 B か右の筒 C に玉を入れます。板 D は支点 E を中心に左右に回転できるので、板 D を動かすことで筒 B と筒 C のどちらに入れるか決めることができます。 阅读全文
posted @ 2019-07-12 23:04 木子川 阅读(98) 评论(0) 推荐(0)
摘要:タナカ氏が HW アールの果樹園を残して亡くなりました。果樹園は東西南北方向に H × W の区画に分けられ、区画ごとにリンゴ、カキ、ミカンが植えられています。タナカ氏はこんな遺言を残していました。 果樹園は区画単位でできるだけ多くの血縁者に分けること。ただし、ある区画の東西南北どれかの方向にとなり 阅读全文
posted @ 2019-07-12 10:08 木子川 阅读(133) 评论(0) 推荐(0)
摘要: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 c 阅读全文
posted @ 2019-07-12 09:27 木子川 阅读(278) 评论(0) 推荐(0)
摘要:Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 阅读全文
posted @ 2019-07-12 09:08 木子川 阅读(398) 评论(0) 推荐(0)
摘要:An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it imme 阅读全文
posted @ 2019-07-12 08:48 木子川 阅读(398) 评论(0) 推荐(0)
摘要:在右侧我们给出了一个已经基本完成的程序,读入了一个字符串,调用了一个叫str_len的函数来计算这个字符串的长度,并输出。 聪明的你应该已经发现了,这个叫str_len的函数并没有完成,在不修改函数原型的情况下,请完成str_len函数,实现我们上述的功能吧。 样例输入复制 abcdefg 样例输出 阅读全文
posted @ 2019-06-02 19:28 木子川 阅读(250) 评论(0) 推荐(0)
摘要:判断一个数是否能被另一个整数整除是一个挺简单的问题,一般一个模运算就可以搞定了,懒惰的晓萌还是不想自己做,于是找到你帮他写代码,你就帮帮他吧。 输入格式 输入包括两个由空格分开的整数 MM 和 N(1\leq M,N \leq 500)N(1≤M,N≤500)。 输出格式 输出包括一行,如果 MM  阅读全文
posted @ 2019-06-02 19:27 木子川 阅读(340) 评论(0) 推荐(0)