随笔分类 - 数学问题
摘要:给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。 1 class Solution { 2 public: 3 double Power(double base, int exponent) { 4 if (exp...
阅读全文
摘要:题目描述大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项。 1 class Solution { 2 public: int Fibonacci(int n) { 5 if (n ==0 || n ==1) 6 return...
阅读全文
摘要:Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is...
阅读全文
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven N rational numbers in the form "numerator/denominator", you are supposed to calculate ...
阅读全文
摘要:时间限制50 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者HE, QinmingGiven any positive integer N, you are supposed to find all of its prime factors, and write ...
阅读全文
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven an increasing sequence S of N integers, themedianis the number at the middle position....
阅读全文
摘要:A + B分数: 1.8时间限制:1 秒内存限制:32 兆特殊判题:否提交:171解决:85标签A+B字符串与数字对应字符串处理题目描述读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出.输入格式测试输入包含若干测试用例,每个测试用例占一行,格式为"A...
阅读全文
摘要:1 #include 2 int main() 3 { 4 int ans1[3]; 5 int ans2[3]; 6 while(scanf("%d.%d.%d %d.%d.%d",&ans1[0],&ans1[1],&ans1[2],&ans2[0],&ans2[1],&a...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 string str; 9 char num[10][6]={"zero","one","two","three","f...
阅读全文
摘要:1 #include 2 #include 3 int main() 4 { 5 long long a,b,c,sum; 6 int n,i; 7 while(scanf("%d",&n)!=EOF) 8 { 9 for(i=1;i0&&b>0...
阅读全文
摘要:时间限制400 ms内存限制32000 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input fi...
阅读全文
摘要:With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba...
阅读全文
摘要:Areversibleprimeinanynumbersystemisaprimewhose"reverse"inthatnumbersystemisalsoaprime.Forexampleinthedecimalsystem73isareversibleprimebecauseitsrevers...
阅读全文
摘要:交换 int a, int b1、最弱的方法1 void swap(int &a,int &b)2 {3 int c = a;4 a = b;5 b = c;6 }2、不用另外开辟空间的方法1 void swap(int &a,int &b)2 {3 a=a+b;4 ...
阅读全文
摘要:1 #include 2 int getbit( int a,int i) 3 { 4 return a&(1 if(n&1 == 0) n/=pow(2,x) ----> n >>= x n*=pow(2,x) ----> n <<= x|或(或1为1)
阅读全文
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number...
阅读全文
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number...
阅读全文
摘要:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135...
阅读全文

浙公网安备 33010602011771号