
NUC(中北大学)
中北大学OJ题解博客
海岛Blog
专注于程序设计及其竞赛,专注于集成电路EDA设计
展开
-
NUC1214 回文素数【回文+素数】
回文素数时间限制: 1000ms 内存限制: 65536KB问题描述151 是一个回文素数,因为它既是一个素数又是回文数(回文数是指一个数 从左到右 和 从右到左 读的结果一样).试写一个程序计算区间 [ a , b ] 内的所有回文素数.( 5 <= a < b <= 100,000,000 )输入描述只有一组测试数据: a b输出描述输出...原创 2017-04-29 11:14:13 · 1872 阅读 · 0 评论 -
NUC1937 B.函数【水题】
B.函数时间限制: 1000ms 内存限制: 65535KB问题描述请编程完成将数组中的数循环移动n个位置(正整数表示右移,负数表示左移,数值表示移动的位置间距),main函数调用其他函数,完成以下功能1)函数1:键盘输入10个数到数组;2)函数2:对这个数组完成移动(使用2个参数:移动距离、移动的数组)3)函数3:输出这10个数输入描述原创 2017-04-29 10:42:57 · 1086 阅读 · 0 评论 -
NUC1003 Hangover【水题】
Hangover时间限制: 1000ms 内存限制: 65536KB问题描述 How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We are assum原创 2017-05-14 15:42:34 · 792 阅读 · 0 评论 -
NUC1178 Kickdown【水题】
Kickdown时间限制: 1000ms 内存限制: 65536KB问题描述A research laboratory of a world-leading automobile company has received an order to create a special transmission mechanism, which allows for incredibly原创 2017-05-14 21:54:24 · 643 阅读 · 0 评论 -
NUC1776 Tiling Up Blocks【二维最长上升子序列+DP】
Tiling Up Blocks时间限制: 1000ms 内存限制: 10000KB通过次数: 2总提交次数: 2问题描述Michael The Kid receives an interesting game set from his grandparent as his birthday gift. Inside the game set box, there are原创 2017-06-27 06:27:28 · 1030 阅读 · 0 评论 -
NUC1840 Graveyard Design【尺取法】
Graveyard Design时间限制: 10000ms 内存限制: 64000KB通过次数: 1总提交次数: 1问题描述King George has recently decided that he would like to have a new design for the royal graveyard. The graveyard must consist of...原创 2017-06-27 06:10:50 · 629 阅读 · 0 评论 -
NUC1131 Triangle【DP】
Triangle时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述图1表示一个数字三角形。73 88 1 02 7 4 44 5 2 6 5(图1)编写一个程序可以按照一种路线求得所划数字的最大和。这种路线可以从顶端开始也可以从底部开始,每一步即可延对角线向左也可以延对原创 2017-06-27 05:54:01 · 511 阅读 · 0 评论 -
NUC1154 Vertical Histogram【打印图案】
Vertical Histogram时间限制: 1000ms 内存限制: 10000KB通过次数: 1总提交次数: 1问题描述Write a program to read four lines of upper case (i.e., all CAPITAL LETTERS) text input (no more than 72 characters per line)原创 2017-06-27 05:35:57 · 601 阅读 · 0 评论 -
NUC1158 Lake Counting【DFS】
Lake Counting时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述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 <...原创 2017-06-27 05:28:48 · 718 阅读 · 0 评论 -
NUC1196 Sum【水题+数学题】
Sum时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述Consider the natural numbers from 1 to N. By associating to each number a sign (+ or -) and calculating the value of this expression we原创 2017-06-25 05:24:09 · 610 阅读 · 0 评论 -
NUC1373 Bank Interest【水题】
Bank Interest时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make. He knows the interes原创 2017-06-25 05:00:37 · 547 阅读 · 0 评论 -
NUC1077 Humble Numbers【数学计算+打表+水题】
Humble Numbers时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14,原创 2017-06-22 07:46:01 · 763 阅读 · 0 评论 -
NUC1305 哥德巴赫猜想【筛选法】
哥德巴赫猜想时间限制: 1000ms 内存限制: 65536KB问题描述对于任何偶数N大于或等于4 ,存在着至少一双素数P1和P2这样 N=P1+P2输入描述每行输入一个偶数,在4到215 之间。当输入0时结束输入输出描述每个输出行应只包含一个整数,输出对数。样例输入610120样例输出121问题...原创 2017-05-12 22:41:47 · 1342 阅读 · 0 评论 -
NUC1921 E.迷雾森林【筛选法】
E.迷雾森林时间限制: 1000ms 内存限制: 65535KB问题描述【HuJie】今天的任务是去灵隐寺后的竹林里拾干柴,最近天越来越冷,天上的乌云聚集不散。天灰蒙蒙的,走进竹林里时,树叶沙沙作响,他一直觉得这个林子很奇怪,雪天依然树叶常青。等他捡的差不多了,正打算将干柴捆好背起来时,在他面前突然跳出一只大大的【Mon-Gee Gee】猴子。“OMG,我不会遇到孙悟空了吧,但是...原创 2017-04-30 18:05:19 · 910 阅读 · 0 评论 -
NUC1014 排版题.输出排列成菱形的字母【打印图案】
排版题.输出排列成菱形的字母时间限制: 1000ms 内存限制: 65536K问题描述输入N值,编程输出如下图形输入描述一个整数N(1 ≤ N ≤ 7 )。输出描述排列成菱形的大写字符,首字符为Z,以后依次为Y,X...样例输入3样例输出 Z Y XW V U T原创 2017-04-30 19:31:02 · 1755 阅读 · 0 评论 -
NUC1157 To the Max【最大子段和+DP】
To the Max时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater原创 2017-06-26 08:03:48 · 678 阅读 · 0 评论 -
NUC1016 斐波那契数列【打表】
斐波那契数列时间限制: 1000ms 内存限制: 65536KB问题描述“斐波那契数列”的发明者,是意大利数学家列昂纳多?斐波那契(生于公元1170年,籍贯大概是比萨,卒于1240年后)。他还被人称作“比萨的列昂纳多”。1202年,他撰写了《珠算原理》一书。斐波那契数列衍生于《珠算原理》中的一道题目:某人把一对兔子放入一个四面被高墙围住的地方。假设每对兔子每月能生下一对小兔,而每对新生小兔从第二个...原创 2017-04-29 08:53:57 · 2315 阅读 · 0 评论 -
NUC1429 WERTYU【输入输出+水题】
WERTYU时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W原创 2017-06-27 06:04:27 · 590 阅读 · 0 评论 -
NUC1011 Financial Management【数学计算+水题】
Financial Management时间限制: 1000ms 内存限制: 10000KB问题描述Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he原创 2017-06-19 00:12:47 · 575 阅读 · 0 评论 -
NUC1003 Hangover【数学计算+水题】
Hangover时间限制: 1000ms 内存限制: 65536KB问题描述 How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We are assum原创 2017-06-19 00:19:00 · 653 阅读 · 0 评论 -
NUC1399 Sum It Up【DFS】
Sum It Up时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, i...原创 2017-06-26 07:52:33 · 682 阅读 · 0 评论 -
NUC1742 Subsequence【前缀和+二分搜索+尺取法】
Subsequence时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 1...原创 2017-06-26 07:47:42 · 515 阅读 · 0 评论 -
NUC1371 Who's in the Middle【中位数+排序】
Who's in the Middle时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the c原创 2017-06-26 07:39:04 · 512 阅读 · 0 评论 -
NUC1076 LCD-Display【打印图案】
LCD-Display时间限制: 1000ms 内存限制: 65536KB问题描述A friend of you has just bought a new computer. Until now, the most powerful computer he ever used has been a pocket calculator. Now, looking at his ne原创 2017-05-14 16:55:55 · 614 阅读 · 0 评论 -
NUC1397 Oil Deposits【DFS】
Oil Deposits时间限制: 1000ms 内存限制: 65535KB问题描述The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of...原创 2017-05-14 23:01:17 · 632 阅读 · 0 评论 -
NUC1019 数素数【素数筛选法】
数素数时间限制: 1000ms 内存限制: 65536KB问题描述素数是的只能被1和它本身整除的自然数。判断一个数是素数的方法是使用2到该数的平方根的素数除它,若有能整除的则该数不是素数。输入描述本题有多组数据,每组数据由两个正整数M,N组成。( 0 < M ≤ N < 1000000)第一行有一个正整数k表示下边有k组数据输出描述输出一个整数,表示...原创 2017-04-30 19:55:23 · 867 阅读 · 0 评论 -
NUC1931 Problem D 区间素数【素数筛选】
Problem D 区间素数时间限制: 1000ms 内存限制: 65535KB问题描述给定一个闭区间[L,R],求区间中所包含的素数的个数。输入描述有空格分隔开的两个正整数L,R(1≤L≤R≤1000)。输出描述闭区间[L,R]中所包含的素数的个数。样例输入3 6样例输出2提示闭区间[3,6]之间包含两个素数3,5...原创 2017-04-30 20:28:16 · 722 阅读 · 0 评论 -
NUC1090 Goldbach's Conjecture【哥德巴赫猜想 】
Goldbach's Conjecture时间限制: 1000ms 内存限制: 65536KB问题描述In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Eve...原创 2017-05-12 22:54:51 · 636 阅读 · 0 评论 -
NUC1100 Biorhythms【中国剩余定理】
Biorhythms时间限制: 1000ms 内存限制: 65536KB问题描述Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotiona原创 2017-05-12 23:52:28 · 724 阅读 · 1 评论 -
NUC1015 计算数字的根
时间限制: 1000ms 内存限制: 65536KB问题描述每个正整数通过每一位的求和都可以找到一个对应的根值.如果求和的结果是一位数字,那么这个数字就是这个正整数的根,如果这个值是两位或多位的话,重复上面的求和,直到求和结果为一位数字.例如:考虑正整数24.把2和4相加得到6.6是一个数字,那么6就是24的根.现在考虑正整数39,3+9=12,12不是一位数.那么重复原创 2017-04-29 08:30:31 · 1538 阅读 · 0 评论 -
NUC1170 加农炮
加农炮时间限制: 1000ms 内存限制: 65536KB问题描述四面体数是指一个以三角形为基的金字塔的总点数。一个用加农炮构建的5层三角形金字塔共含有35个炮弹。如下图:请写程序计算加农炮的个数!输入描述输入不定个数数据.每行一个正整数N,表示基三角形的边长。(1 ≤ N ≤ 10000000)N=0表示输入结束。输出描述输出加农炮的个数,原创 2017-05-14 20:14:19 · 794 阅读 · 0 评论 -
NUC1445 Euclid's Game【博弈】
Euclid's Game时间限制: 1000ms 内存限制: 65535KB问题描述Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the tw原创 2017-05-20 20:13:39 · 724 阅读 · 0 评论 -
NUC1333 Knight Moves【DFS】
Knight Moves时间限制: 1000ms 内存限制: 65535KB问题描述A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits ea...原创 2017-06-20 00:38:02 · 658 阅读 · 0 评论 -
NUC1372 Bull Math【大数】
Bull Math时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so t原创 2017-06-20 22:37:39 · 534 阅读 · 0 评论 -
NUC1312 Sum【水题+数学题】
Sum时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述认为自然数是从1—N。将每个数和+或-联系起来,然后计算这个表达式的值我们得到一个和S。这个问题就是怎样用1-N之间的数来得到给定的和S,并且使N最小。对于给定的S,根据题意找出可以得到S的最小值N输入描述第一行中也就是仅有的一行有正整数S(0原创 2017-06-26 07:33:19 · 483 阅读 · 0 评论 -
NUC1041 数字三角形【DP】
USACO Gateway数字三角形时间限制: 1000ms 内存限制: 32768KB问题描述佳佳遇到一个麻烦的问题,如下图所示,一个数字三角形,佳佳想找出从三角形顶点到底某处的一条路径,使的该路径所经过的数字总和最大.(1).每一步可沿左斜线向下或右斜线向下.(2).1L)图中沿所画的线路可得到最大的值,但是佳佳遇到很多数字三角形,请你帮她写原创 2017-05-07 07:23:37 · 844 阅读 · 0 评论 -
NUC1177 排序【排序】
排序时间限制: 1000ms 内存限制: 65536KB通过次数: 1总提交次数: 1问题描述排序正整数,按从小到大的顺序输出。输入描述输入数据只有1组第一行一个正整数n(1 ≤ n ≤ 100)下边n行每行一个正整数。输出描述从小到大输出排序后的结果样例输入531002365422样例输出原创 2017-06-25 05:18:05 · 505 阅读 · 0 评论 -
NUC1013 阶乘结果末尾有多少零【分析思维】
阶乘结果末尾有多少零时间限制: 1000ms 内存限制: 65536KB通过次数: 4总提交次数: 14问题描述1000的阶乘1*2*3*...*1000结果是一个超过2500位的数,求这么大的数末尾有多少个连续的零。输入描述本题有多组测试数据,每组测试数据占一行。 每组数据含有一个正整数N。(N不大于1000000000) 输出描述输出一个原创 2017-06-24 09:15:23 · 650 阅读 · 0 评论 -
NUC1419 位操作【位运算+STL】
位操作时间限制: 8000ms 内存限制: 65535KB通过次数: 2总提交次数: 2问题描述假设你工作在一个32位的机器上,你需要将某一个外设寄存器的第X位设置成0(最低位为第0位,最高位为第31位),将第Y位开始的连续三位设置成110(从高位到低位的顺序),而其他位保持不变。对给定的寄存器值R,及X,Y,编程计算更改后的寄存器值R。输入描述仅一行,包括原创 2017-06-24 07:42:22 · 533 阅读 · 0 评论 -
NUC1422 字母旋转游戏【水题】
字母旋转游戏时间限制: 1000ms 内存限制: 65535KB通过次数: 2总提交次数: 5问题描述给定两个整数M,N,生成一个M*N的矩阵,矩阵中元素取值为A至Z的26个字母中的一个,A在左上角,其余各数按顺时针方向旋转前进,依次递增放置,当超过26时又从A开始填充。例如,当M=5,N=8时,矩阵中的内容如下: A B C D E F G原创 2017-06-24 07:36:48 · 638 阅读 · 0 评论