SGU
文章平均质量分 52
_Reimu
这个作者很懒,什么都没留下…
展开
-
SGU101 DFS
题意:给你一些Domino,两端有数字,问能否用全部骨牌首尾相连成一条链,使得相连的两端数字相同。可以的话要给出方案。 Problem:Give you some dominoes which have numbers on it's both sides. Can you connect the dominoes one by one to form a chain? It requi原创 2013-11-20 22:11:34 · 891 阅读 · 0 评论 -
SGU117 水题 Easy
问题:N个数中有多少个数的M次方能被K整除。Problem: Find amount of numbers for given sequence of integer numbers such that after raising them to the M-th power they will be divided by K.解法:注意到每个数不超10000,这个题就沦为水题了。求质数,原创 2014-01-30 15:23:57 · 1218 阅读 · 0 评论 -
SGU116 动态规划 DP
问题:超级质数是在质数序列中下标也是质数的质数,例如3,5,11……现在给你一个数,找一个由超级质数构成的最小表示使得这些数的和等于这个数。解法:先求出这些超级质数,然后就是个完全背包问题。具体可见我动态规划关于背包的文章。Problem: Super-prime number is such a prime number that its current number in prime原创 2014-01-29 22:54:17 · 1178 阅读 · 0 评论 -
SGU114 水题 Easy Problem
题意:N个城市在坐标轴上,每个城市有坐标和人口。现设立一个广播站,每个城市的不满度是该城市人口与该城市到广播站距离的乘积。求广播站坐标使得各个城市不满度之和最小。Problem: Every city in Berland is situated on Ox axis. The government of the country decided to build new telecasting原创 2014-01-28 21:56:30 · 1417 阅读 · 0 评论 -
SGU113 水题 Easy Problem
问题:判断一个数是否是两个质数的乘积。Problem: Nearly prime number is an integer positive number for which it is possible to find such primes P1 and P2 that given number is equal to P1*P2. There is given a sequence on原创 2014-01-28 17:15:45 · 1183 阅读 · 0 评论 -
SGU115 水题 Too Easy
Problem: Write a program that finds the name of the day of the week for any date in 2001(Monday – number 1, … , Sunday – number 7).Solution: "Impossible" is important...#include #include using n原创 2014-01-28 22:03:29 · 1142 阅读 · 0 评论 -
SGU112 水题 Easy
Problem: You are given natural numbers a and b. Find a^b-b^a.Solution: It is easy to solve in C++. More easier in Java!import java.util.Scanner;import java.math.BigInteger;import java.io.*;pub原创 2014-01-04 22:15:05 · 841 阅读 · 0 评论 -
SGU111 大数开方 Evolution
Problem: You are given natural number X. Find such maximum integer number that it square is not greater than X.(X.length解法:想用java水过但是跪了。上网查到了笔算开方,不过另一段短小的程序却更神奇。完全不会= 。= 于是收录在这里了。Solution: A smal原创 2014-01-04 22:11:55 · 1160 阅读 · 1 评论 -
SGU110 计算几何 Computational Geometry
题意:三维空间N个球体,给一个光束的方向,求它在这些球体间的反射情况(球面反射)。Problem: N spheres are in a 3D-space. Give you a direction of a light and write a program to output the reflections(the light rays reflect from the surface o原创 2014-01-04 22:03:06 · 1220 阅读 · 0 评论 -
SGU109 奇偶性 problem of parity
题意:N*N的方格,第一个人从1号格(左上)开始走K1步(上下左右),然后去掉他永远不可能走到的格子。第二个人接着第一个人的终点走K2步,再去掉他永远走不到的格子。以此类推,直到有一个人被困在唯一一个格子里。求给出K1到Ke,以及每次去掉了哪些格子(e是自己定的,符合题意就好)。Problem: Give you a N*N girds. The first person walks K1 s原创 2014-01-03 11:53:55 · 1082 阅读 · 0 评论 -
SGU108 数学题 Math
题目:一个数n,d(n)是n的各个位之和与它本身的和,比如d(35) = 35 + 3 + 5 = 43。n成为d(n)的产生数。现在给你一个数N和K,以及K个数Sk,问1-N有多少个自我数(没有产生数),以及第Sk个自我数是多少。Problem: For any positive integer n, define d(n) to be n plus the sum of the digit原创 2014-01-01 17:21:47 · 1158 阅读 · 0 评论 -
SGU107 水题 Easy
Problem: For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.解法:编个程找规律,然后直接写。Solution: Write a program to find the rules then原创 2014-01-01 17:02:40 · 892 阅读 · 0 评论 -
SGU104 DP
题意:N行M列的格子,每个格子有一些分值(可能为负),每行取一个格子,使得选取的总分值最大。要求每行所取的格子的列号严格大于上一行。 Problem:Give you a matrix of N rows and M columns, each grid has a value(maybe negative). You pick only one grid in each row to原创 2013-11-23 10:31:19 · 772 阅读 · 0 评论 -
SGU106 Extend GCD
题意:给出方程ax + by + c = 0,以及a,b,c,x1,x2,y1,y2, 问有多少整数解(x,y)满足x1 Problem:There is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this equation are原创 2013-11-23 11:14:29 · 839 阅读 · 0 评论 -
SGU105 水题 An easy problem
题意:这样的序列1,12,123,1234,...,12345678910,..问前N个元素和能否被3整除。 Problem:There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of nu原创 2013-11-23 10:36:03 · 923 阅读 · 0 评论 -
SGU102 水题 An easy problem
题意:多少个不大于N的正整数与N互质。 Problem:For given integer N (1N104) find amount of positive numbers not greater than N that coprime with N. Let us call two positive integers (say, A and B, for example) cop原创 2013-11-20 22:17:11 · 1056 阅读 · 0 评论 -
SGU103 最短路 Shortest Path
题意:一个带权无向图,每个点有一个只有两种颜色的指示灯,每个灯初始颜色维持一定时间T1后变色,之后经过T2时间变色、T3时间变色、T2时间再变……成周期。一条边只有两个端点的指示灯颜色相同时才能通过,否则要等到相同。问从1到N的最短时间花费以及路径方案。 Problem:Give you a weighted undirected graph, each node has a traff原创 2013-11-20 22:48:54 · 1102 阅读 · 0 评论 -
SGU118 数学题 Math
问题:令f(n)为n各个位数字之和。n的Digital Root是f(f(...f(n))),是一位数字。现在给你A1,A2...An,n个数,求A1*A2*…*AN + A1*A2*…*AN-1 + … + A1*A2 + A1的Digitial Root。Problem: Let f(n) be a sum of digits for positive integer n. If f(n)原创 2014-01-30 17:19:19 · 1265 阅读 · 0 评论