- 博客(101)
- 收藏
- 关注
转载 机试漫谈
一、string 转 int头文件“stdlib.h”atoi这个函数是把char * 转换成int的。应该是属于标准库函数。在想把string 转换成int的时候,须要下面流程:不能直接printf string,string为拓展类,链接错误。printf只能输出C的内置数据。string -> char * -> intstring a = "1...
2019-01-23 00:23:00
146
转载 stl学习之namespace
一、为什么需要命名空间(问题提出) 命名空间是ANSIC++引入的可以由用户命名的作用域,用来处理程序中常见的同名冲突。 在 C语言中定义了3个层次的作用域,即文件(编译单元)、函数和复合语句。C++又引入了类作用域,类是出现在文件内的。在不同的作用域中可以定义相同名字的变量,互不于扰,系统能够区别它们。转载于:https://www.cnblogs.com/ygt...
2019-01-19 00:06:00
201
转载 蓝桥杯第七届决赛(国赛)C++B组 第四题 机器人塔
机器人塔X星球的机器人表演拉拉队有两种服装,A和B。他们这次表演的是搭机器人塔。类似: A B B A B A A A B BB B B A BA B A B B A队内的组塔规则是: A 只能站在 AA 或 BB 的肩上。 B 只能站在 AB 或 BA 的肩上。你的任务是帮助拉拉队计算一下,在给定A与B的人数时,可以组成多少种花样的塔。...
2018-05-13 01:34:00
336
转载 uva_11806_Cheerleaders
In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is ...
2018-01-01 17:12:00
173
转载 帕斯卡三角形,二项式定理
组合数学少不了二项式,今天来补一补。 0 |1 |2 | 3 |4 |5 |6 |7 |80 1 | | | | | | | |1 1 |1 | | | | | | |2 1 |2 |1 ...
2018-01-01 16:10:00
802
转载 hdu_5187_zhx's contest
Problem DescriptionAs one of the most powerful brushes, zhx is required to give his juniors n problems.zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beau...
2018-01-01 15:25:00
103
转载 hdu_5698_瞬间移动
有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第nn行第mm列的格子有几种方案,答案对10000000071000000007取模。 Input多组测试数据。 两个整数n,m(2≤n,m≤100000)n,m(2≤n,m≤100000) O...
2017-12-19 16:13:00
106
转载 hdu_4336_Card Collector
In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in the famous novel Water Margin, you will win an ...
2017-12-19 15:36:00
122
转载 hdu_4135_Co-prime
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be co-prime or relatively prime if they have no...
2017-12-19 15:19:00
98
转载 hdu_4465_Candy
LazyChild is a lazy child who likes candy very much. Despite being very young, he has two large candy boxes, each contains n candies initially. Everyday he chooses one box and open it. He chooses...
2017-12-19 15:15:00
178
转载 hdu_2067_小兔的棋盘
小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很长时间都没想出来,现在想请你帮助小兔解决这个问题,对于你来说应该不难吧!Input每次输入一个数n...
2017-12-14 21:40:00
121
转载 poj_2084_Game of Connections
This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some st...
2017-12-14 21:36:00
118
转载 poj_2773_Happy 2006
Two positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relatively prime to 2006. Now your job ...
2017-12-14 21:28:00
83
转载 poj_1091_跳蚤
Z城市居住着很多只跳蚤。在Z城市周六生活频道有一个娱乐节目。一只跳蚤将被请上一个高空钢丝的正中央。钢丝很长,可以看作是无限长。节目主持人会给该跳蚤发一张卡片。卡片上写有N+1个自然数。其中最后一个是M,而前N个数都不超过M,卡片上允许有相同的数字。跳蚤每次可以从卡片上任意选择一个自然数S,然后向左,或向右跳S个单位长度。而他最终的任务是跳到距离他左边一个单位长度的地方,并捡起位于那里的礼...
2017-12-14 21:18:00
94
转载 poj_1306_Combinations
Computing the exact number of ways that N things can be taken M at a time can be a great challenge when N and/or M become very large. Challenges are the stuff of contests. Therefore, you are to m...
2017-12-14 21:09:00
128
转载 poj_2249_Binomial Showdown
In how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number. Input The input will contain one or more...
2017-12-14 21:07:00
147
转载 poj_3256_Cow Picnic
The cows are having a picnic! Each of Farmer John's K (1 ≤ K ≤ 100) cows is grazing in one of N (1 ≤ N ≤ 1,000) pastures, conveniently numbered 1...N. The pastures are connected by M (1 ≤ M ≤ 1...
2017-12-14 21:06:00
97
转载 hdu_3123_GCC
The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by the GNU Project supporting various programming languages. But it doesn’t contains the math operator “!”. In...
2017-11-26 21:32:00
95
转载 hdu_2588_GCD
The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6. (a,b) can be easily found by...
2017-11-26 21:27:00
70
转载 hdu_1788_Chinese remainder theorem again (lcm
我知道部分同学最近在看中国剩余定理,就这个定理本身,还是比较简单的: 假设m1,m2,…,mk两两互素,则下面同余方程组: x≡a1(mod m1) x≡a2(mod m2) … x≡ak(mod mk) 在0<=<m1m2…mk内有唯一解。 记Mi=M/mi(1<=i<=k),因为(Mi,mi)=1,故有二个整数pi,qi满足...
2017-11-26 21:16:00
185
转载 hdu_1573_X问题 (分段之中国剩余
求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod a[i] = b[i], … (0 < a[i] <= 10)。Input输入数据的第一行为一个正整数T,表示有T组测试数据。每组测试数据的第一行为两个正整数N,M (0 < N <= 10...
2017-11-26 21:11:00
100
转载 hdu_2837_Calculation(欧拉函数,快速幂求指数循环节)
Assume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).InputThe first line contains a singl...
2017-11-26 20:59:00
185
转载 hdu_5288_OO’s Sequence
OO has got a array A of size n ,defined a function f(l,r) represent the number of i (l<=i<=r) , that there's no j(l<=j<=r,j<>i) satisfy a i mod a j=0,now OO want to know∑i=1n∑...
2017-11-26 20:30:00
68
转载 poj_3641_Pseudoprime numbers
Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not very...
2017-11-26 20:12:00
73
转载 poj_1995_Raising Modulo Numbers
DescriptionPeople are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult ma...
2017-11-26 20:07:00
115
转载 poj_1320_Street Numbers
A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her dog by leaving her house and randomly turning left or ...
2017-11-26 20:03:00
120
转载 hdu_4944_FSF’s game
FSF has programmed a game. In this game, players need to divide a rectangle into several same squares. The length and width of rectangles are integer, and of course the side length of squares...
2017-11-25 22:36:00
134
转载 poj_3696_The Luckiest number
Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the minimum among al...
2017-11-22 22:20:00
151
转载 poj_2689_Prime Distance
The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of pr...
2017-11-22 22:13:00
96
转载 UVA_1434_YAPTCHA
The math department has been having problems lately. Due to immense amount of unsolicited automated programs which were crawling across their pages, they decided to put Yet-Another-Public-Turing-...
2017-11-20 19:01:00
116
转载 10^9以上素数判定,Miller_Rabin算法
#include<iostream>#include<cstdio>#include<ctime>#include<string.h>#include<stdlib.h>#define LL long longusing namespace std;const int S=20;//随机算法判...
2017-11-19 21:24:00
464
转载 poj_1845_Sumdiv
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natu...
2017-11-19 18:46:00
110
转载 等比数列求和
__int64 sum(__int64 p,__int64 n) //递归二分求 (1 + p + p^2 + p^3 +...+ p^n)%mod{ //奇数二分式 (1 + p + p^2 +...+ p^(n/2)) * (1 + p^(n/2+1)) if(n==0) //偶数二分式 (1 + ...
2017-11-19 18:42:00
199
转载 hdu_3501_Calculation 2
Given a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is said to be coprime to B if A, B share no common positive diviso...
2017-11-15 19:31:00
70
转载 hdu_1452_Happy 2004 (乘法逆元
Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of S by 29). Take X = 1 for an ex...
2017-11-14 21:40:00
98
转载 poj_1730_Perfect Pth Powers
We say that x is a perfect square if, for some integer b, x = b 2. Similarly, x is a perfect cube if, for some integer b, x = b 3. More generally, x is a perfect pth power if, for some integer b,...
2017-11-14 17:17:00
74
转载 poj_1284_Primitive root
We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (x i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, the consecuti...
2017-11-14 15:49:00
154
转载 UVA_10820_send a table
When participating in programming contests, you sometimes face the following problem: You know how to calcutale the output for the given input values, but your algorithm is way too slow to ever p...
2017-11-11 17:35:00
115
转载 阶乘分解质因子指数和
The factorial function, n! = 1·2·...·n, has many interesting properties. In this problem, we want to determine the maximum number of integer terms (excluding 1) that can be used to express n!. Fo...
2017-11-11 17:02:00
203
转载 UVA_10139
The factorial function, n! is defined thus for n a non-negative integer:0! = 1 n! = n×(n−1)! (n > 0)We say that a divides b if there exists an integer k such that k×a = bInputThe input to you...
2017-11-09 21:28:00
143
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人