1028: 数字工程
题目描述
ACM实验室开启了一个数字工程项目,希望把正整数n通过一些特殊方法变成1。
可采用的方法有:(1)减去1;(2)除以它的任意一个素因子。 每操作一次消耗一个单位的能量。
ACM实验室开启了一个数字工程项目,希望把正整数n通过一些特殊方法变成1。
可采用的方法有:(1)减去1;(2)除以它的任意一个素因子。 每操作一次消耗一个单位的能量。
1427 - Substring Frequency (II)
InputA string is a finite sequence of symbols that are chosen from an alphabet. In this problem you are given a string T and n queries each with a string Pi, where the strings contain lower case English alphabets onl >>继续阅读
1369 - Answering Queries
long long f( int A[], int n ) { // n = size of AThe problem you need to solve here is pretty simple. You are give a function f(A, n), where A is an array of integers and n is the number of elements in the array. f(A, n) is >>继续阅读
1337 - The Crystal Maze
To be more exact, the maze can be modeled as an M x N 2D grid where M denotes the number of rows and N denotes the number of columns. There are three types of cells in the grid:You are in a plane and you are about to be drop >>继续阅读
1325 - Distributing Chocolates
InputNow as the result can be large, I asked for the result modulo 100 000 007 (a prime). But after that I found that this problem is easier than I thought. So, I changed the problem a little bit. I will give you the >>继续阅读
1319 - Monkey Tradition
1) There are N monkeys who play this game and there are N bamboos of equal heights. Let the height be L meters.In 'MonkeyLand', there is a traditional game called "Bamboo Climbing". The rules of the game are as follows >>继续阅读
1294 - Positive Negative Sign
-1 -2 -3 +4 +5 +6 -7 -8 -9 +10 +11 +12Given two integers: n and m and n is divisible by 2m, you have to write down the first n natural numbers in the following form. At first take first m integers and make their sign n >>继续阅读
1266 - Points in Rectangle
InputAs the name says, this problem is about finding the number of points in a rectangle whose sides are parallel to axis. All the points and rectangles consist of 2D Cartesian co-ordinates. A point that lies in the bound >>继续阅读
1259 - Goldbach`s Conjecture
Every even integer, greater than 2, can be expressed as the sum of two primes [1].Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:
Now your task is to >>继续阅读
1255 - Substring Frequency
InputA string is a finite sequence of symbols that are chosen from an alphabet. In this problem you are given two non-empty strings A and B, both contain lower case English alphabets. You have to find the number of times >>继续阅读
1215 - Finding LCM
You will be given a, b and L. You have to find c such that LCM (a, b, c) = L. If there are several solutions, print the one where c is as small as possible. If there is no solution, report so.LCM is an abbreviation used for Least >>继续阅读
1213 - Fantasy of a Summation
#include <stdio.h>If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.
int cases, caseno;
int n, K >>继续阅读
1212 - Double Ended Queue
pushLeft(): inserts an item to the left end of the queue with the exception that the queue is not full.A queue is a data structure based on the principle of 'First In First Out' (FIFO). There are two ends; one end can be u >>继续阅读
1202 - Bishops
Now you are given the position of the two bishops. You have to find the minimum chess moves to take one to another. With a chess move, a bishop can be moved to a long distance (along the diagonal lines) with just one move.There is an >>继续阅读
1198 - Karate Competition
Your secret agents have determined the skill of every member of the opposing team, and of course you know the skill of every member of your own team. You can use this information to decide which opposing player will play a >>继续阅读
1197 - Help Hanzo
Before reaching Amakusa's castle, Hanzo has to pass some territories. The territories are numbered as a, a+1, a+2, a+3 ... b. But not all the territories are safe for Hanzo because there can be other fighters waiting for him. Actu >>继续阅读