http://acm.uestc.edu.cn/problem.php?pid=1784&&
http://acm.uestc.edu.cn/problem.php?pid=1784&&
Description
时间是最难以捉摸的东西,光是测量它们就已经很难了。一般而言,测量时间用一个可重复等时长发生的事件来定义最小的时间可测单位。于是Krolia想到了一个测量时间的好方法。
Krolia有一盒火柴,如果把火柴的头去掉火柴就会变成一样长的木棍。Krolia知道一根(没有火柴头)木棍一端点燃后,整个燃烧会持续x时间。Krolia还可以从两端同时点燃木棍,这样燃烧会持续x/2时间。现在Krolia想用这堆火柴来计时,问什么样的时间可以被完全精确地计算出。
Input
第一行一个整数T(T
Output
一个字符串,"YES"或者"NO"表示能或者不能被精确计算。
Sample Input
4
1 1 1
1 2 1
1 4 1
1 5 1
Sample Output
YES
YES
YES
NO
Hint
从一端点燃一根木棍。
从两端同时点燃一根木棍。
从两端同时点燃一根木棍的同时,从一端点燃一根木棍。当第一根木棍燃烧殆尽的时候,把剩下的那根木棍的火熄灭。最后把剩下的木棍的两端同时点燃。
昨天下午的比赛题,一个规律找了很久的题~
题意:给你两个数x和x/2,问能否表示出a/b,通过找规律可知,如果x是偶数可以将其转化奇数,然后找到x为奇数的规律:分子a必须可以整除x,b一定可以转化为2的几次方的形式。
AC代码:
#include <iostream> #include<string.h> #include<algorithm> #include<cstdio> #define CLR(arr,val) memset(arr,val,sizeof(arr)) using namespace std; int gcd(int a,int b) { while(b) { int temp=a%b; a=b; b=temp; } return a; } void in(int &a) { char ch; while((ch=getchar())'9'); for( a=0;ch>='0'&&ch<br> <br> <p></p> <div class="clear"> </div></cstdio></algorithm></string.h></iostream>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

We know that in C language, 'while' keyword is used to define a loop that works based on the condition passed to the loop. Now, since the condition can have two values, true or false, the code inside the while block will be executed repeatedly if the condition is true and will not be executed if the condition is false. Now, by passing parameters to the while loop, we can differentiate between while(1) and while(0) because while(1) is a loop where the condition is always considered true and hence the code inside the block will start executing repeatedly. Furthermore, we can state that it is not 1 that is passed to the loop that makes the condition true, but if any non-zero integer is passed to the while loop, then it will be considered as the true condition, so

Detailed explanation of the method of converting int type to byte in PHP In PHP, we often need to convert the integer type (int) to the byte (Byte) type, such as when dealing with network data transmission, file processing, or encryption algorithms. This article will introduce in detail how to convert the int type to the byte type and provide specific code examples. 1. The relationship between int type and byte In the computer field, the basic data type int represents an integer, while byte (Byte) is a computer storage unit, usually 8-bit binary data

When we write web pages using PHP, sometimes we need to include code from other PHP files in the current PHP file. At this time, you can use the include or include_once function to implement file inclusion. So, what is the difference between include and include_once?

In C++, variables of type int can only hold positive or negative integer values; they cannot hold decimal values. There are float and double values available for this purpose. The double data type was created to store decimals up to seven digits after the decimal point. Conversion of an integer to a double data type can be done automatically by the compiler (called an "implicit" conversion), or it can be explicitly requested by the programmer from the compiler (called an "explicit" conversion). In the following sections, we'll cover various conversion methods. Implicit conversions The compiler performs implicit type conversions automatically. To achieve this, two variables are required - one of floating point type and the other of integer type. When we simply assign a floating point value or variable to an integer variable, the compiler takes care of all the other things

The value range of int32 is from -2 to the 31st power to 2 to the 31st power minus 1, that is, -2147483648 to 2147483647. int32 is a signed integer type, which means it can represent positive numbers, negative numbers, and zero. It uses 1 bit to represent the sign bit, and the remaining 31 bits are used to represent the numerical value. Since one bit is used to represent the sign bit, the effective number of int32 bits is 31.

Conversion method: 1. Use the Itoa() function, the syntax "strconv.Itoa(num)"; 2. Use the FormatInt() function to convert int type data into the specified base and return it in the form of a string, the syntax "strconv .FormatInt(num,10)".

The number of bytes occupied by the int type may vary in different programming languages and different hardware platforms. Detailed introduction: 1. In C language, the int type usually occupies 2 bytes or 4 bytes. In 32-bit systems, the int type occupies 4 bytes, while in 16-bit systems, the int type occupies 2 bytes. In a 64-bit system, the int type may occupy 8 bytes; 2. In Java, the int type usually occupies 4 bytes, while in Python, the int type has no byte limit and can be automatically adjusted, etc.

In Java, int is a 32-bit signed data type, and its variables require 32-bit memory; the valid range of the int data type is -2147483648 to 2147483647, and all integers in this range are called integer literals. An integer literal can be assigned to an int variable, such as "int num1 = 21;".
