02 2016 档案
摘要:int gcd (int x, int y)//最大公约数 { return y == 0 ? x : gcd( y , x % y ); } int lcm(int x, int y)//最小公倍数 { return x*y/gcd(x,y); }
阅读全文
摘要:Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different gende
阅读全文
摘要:Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003.
阅读全文
摘要:Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0
阅读全文
摘要:Description 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 <= 10
阅读全文
摘要:DFS主要在于参数的改变; 样例输入: n=4 //给定n个数字 a={1,2,4,7} //输入n个数据 k=15 //目标数字 样例输出: No 题意: 给定的数字在不重复使用的前提下能否达到目标,能输出Yes,否输出No#include<algorithm> #include<iostream
阅读全文
摘要:每瓶啤酒2元,2个空酒瓶或4个瓶盖可换1瓶啤酒。10元最多可喝多少瓶啤酒? #include<algorithm> #include<iostream> using namespace std; int dfs(int p, int g, int ans) { if(p < 2 && g < 4)
阅读全文
摘要:位运算加速技巧1. 如果乘上一个2的倍数数值,可以改用左移运算(Left Shift) 加速 300% x = x * 2; x = x * 64; //改为: x = x << 1; // 2 = 21 x = x << 6; // 64 = 26 2. 如果除上一个 2 的倍数数值,可以改用右移
阅读全文
摘要:Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangula
阅读全文
摘要:Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,00
阅读全文
摘要:迷宫问题 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,
阅读全文
摘要:Dungeon Master Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or m
阅读全文