- 博客(77)
- 资源 (5)
- 收藏
- 关注
原创 UVA 11292 Dragon of Loowater
题解: 贪心.. 恶龙有n个头 有m个猎人n mx(共n行 x表示砍断相应头所需的值)x....xy(共m行 y表示猎人的砍龙头的能力也是雇佣金的数目)cy...y排序+贪心(水题)AC代码:#include #include #include #include #include #include #include
2016-10-21 21:37:45
381
原创 Codeforces Round #376 (Div. 2)
A - Night at the MuseumTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 731ADescriptionGrigoriy, like the hero of
2016-10-19 23:13:26
645
原创 hdu 1753 大明A+B
Description话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。 这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。 现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。 Input本题目包含多组测试数据,请处理到文件结束。 每一组测试数据在一行
2016-07-17 11:42:57
424
原创 Poj 3304 Segments
DescriptionGiven n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at
2016-07-04 13:08:17
360
原创 Poj 1654 Area
DescriptionYou are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate system. From this vertex, you may go step by step
2016-07-04 09:25:07
310
原创 Poj 1269 Intersecting Lines
DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are paral
2016-07-04 09:14:18
450
原创 取(2堆)石子游戏
Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。如果你胜,你第1次怎样取子? Input
2016-07-01 22:53:30
933
原创 HDU 2149 Public Sale(巴什博奕)
Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。 要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。 后来发现,整个拍卖会只有Lele和他的死对头Yueyue。 通
2016-07-01 22:48:23
290
原创 Poj 1067 取石子游戏
Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 Input输入包含若干行,表示若干种石子
2016-07-01 22:45:54
285
原创 HDU 1222 Wolf and Rabbit(gcd)
DescriptionThere is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first h
2016-06-27 22:30:28
408
原创 POJ 2262 Goldbach's Conjecture(素数)
DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be wri
2016-06-27 22:28:51
326
原创 A/B(乘法逆元)
A/BDescription要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 Output对应每组数据输出(A/B)%9973。
2016-06-27 22:25:08
486
原创 欧几里德与扩展欧几里德算法
欧几里德算法(辗转相除法) 可用于计算两个整数a,b的公约数和公倍数定理:gcd(a, b) = gcd(b , a%b)int gcd(int a,int b){ return b ? gcd(b,a%b):a;}最小公倍数是: a*b/gcd(a,b) 不过我们为了防止a*b的溢出 采取先除后乘a/gcd(a,b)*b扩展欧几里德算法基本算法:对于不完
2016-06-27 21:58:21
238
原创 COJ 1010 [001]质因数分解 [EASY]
[001]质因数分解 [EASY]Time Limit: 1000 ms Memory Limit: 65536 KBTotal Submit: 1891 Accepted: 582 Description找出输入整数的所有质因数(包括重复质因数),并按从小到大的顺序依次输出。Input输入一组待分解整数,每个整数k占一行。
2016-06-24 10:09:43
1051
原创 HDU 1248 寒冰王座 (完全背包)
Description不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前. 死亡骑士:"我要买道具!" 地精商人:"我们这里有三种道具,血瓶150块一个,魔法药200块一个,无敌药水350块一个." 死亡骑士:"好的,给我一个血瓶." 说完他掏出那张N元的大
2016-05-24 23:40:53
531
原创 POJ 3624 Charm Bracelet (01背包)
DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N(1 ≤ N ≤ 3,402) available charms. Each
2016-05-24 23:38:42
266
原创 HDU 2602 Bone Collector(01背包)
DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave … Th
2016-05-24 23:37:15
223
原创 5-38 数列求和-加强版 (20分)
#include #include #include using namespace std;int a[10000020]= {0};int main(){ int A,N,b,i=0; scanf("%d%d",&A,&N); if(N==0) printf("%d",N); else { int m=N;
2016-05-24 23:33:18
1072
转载 5-37 整数分解为若干项之和 (20分)
#includeint s[100];//拆分结果保存在这个数组里int top;//记录个数int total, n;//累加数和所求数int k;void dfs(int index){ int i; if (total == n){ printf("%d=", n); for (i =
2016-05-24 23:32:49
1634
原创 5-36 复数四则运算 (15分)
#include#include#include#includeusing namespace std;int main(){ double a1,i1,a2,i2; cin>>a1>>i1>>a2>>i2; double jiashi,jiaxu; double jianshi,jianxu; double chengshi,chengxu; double chushi,
2016-05-24 23:32:21
1863
1
原创 5-35 有理数均值 (20分)
#include #define N 100struct Rational{ int n; int d;};int gcd(int m, int n){ int r; if (m == 0 && n == 0) return 0; if (m == 0) return n; if (n == 0)
2016-05-24 23:31:53
1169
原创 5-34 通讯录的录入与显示 (10分)
#include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3fstruct tel{ string name, time, sex, tele,phone;};int main(){ int n,k,m; tel a[
2016-05-24 23:31:24
1916
1
原创 5-33 有理数加法 (15分)
#include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3fint GCD(int aa, int bb){ int A=aa,B=bb; int a=1; if(A!=0) { int temp;
2016-05-24 23:30:50
1765
原创 5-32 说反话-加强版 (20分)
#include #include #include #include using namespace std;string str;stack s;int main(){ while(getline(cin,str)) { istringstream it(str); bool isfirst = true; whi
2016-05-24 23:30:10
1932
原创 5-31 字符串循环左移 (20分)
#include #include #include #include using namespace std;int main(){ string str1; getline(cin,str1); int i,length=str1.size(),n; scanf("%d",&n); for(i=n; i<length+n; i++)
2016-05-24 23:29:01
1069
原创 5-30 字符串的冒泡排序 (20分)
#include #include #include #include #include #include using namespace std;int main(){ int i,j,n,k; char str[200][20]; scanf("%d %d",&n,&k); for(i=0; i<n; i++) { sc
2016-05-24 23:28:20
1193
转载 5-29 删除字符串中的子串 (20分)
#include #include #define N 80void del_str(char *str, char *s, char *resultstr) //删除函数{ int i, j, resultstr_len, s_len; //resultstr_len为resultstr字符串的长度,s_str为s字符串的长度
2016-05-24 23:27:32
1595
原创 5-28 猴子选大王 (20分)
#include int main(){ int m,i,s=0; scanf("%d",&m); for(i=1 ; i<=m ; i++) s = (s+3) % i ; printf("%d\n",s+1); return 0 ;}
2016-05-24 23:26:36
1401
1
原创 5-27 冒泡法排序 (20分)
#include#include#include#include#include#include#include#includeusing namespace std;int main(){ int a[120]; int n,i,j,c=0,K; scanf("%d%d",&n,&K); for(i=0; i<n; i++)
2016-05-24 23:26:16
1500
原创 5-26 单词长度 (15分)
#include #include #include #include #include #include using namespace std;int main(){ string str1; getline(cin,str1); int len=str1.size(); str1[len-1]=' '; istringstream it(str
2016-05-24 23:25:53
770
原创 5-25 念数字 (15分)
#include #include #include #include #include using namespace std;int main(){ char a[20]; scanf("%s",a); int len=strlen(a); for(int i=0;i<len;i++) { if(a[i]=='-') printf("
2016-05-24 23:25:31
2668
原创 5-24 约分最简分式 (15分)
#include #include #include #include #include using namespace std;int main(){ int m,n; char c; scanf("%d%c%d",&m,&c,&n); int m1=m,n1=n; int a=1; if(m>n) swap(m,n);//使m成为
2016-05-24 23:25:07
2800
原创 5-23 币值转换 (20分)
#include#include#includeusing namespace std;char ans[100];int main(){ bool b; int l, num, n, d; while (scanf("%d", &num) == 1) { memset(ans, 0, sizeof(ans)); d = 0; l = 0; b = true
2016-05-24 23:24:37
1514
原创 5-22 龟兔赛跑 (20分)
#includeint main(){ int T, i; int rabbitT=0; //兔子跑的时间 scanf("%d",&T); if(T<10) { printf("^_^ %d\n",T*9); return 0; } rabbitT=10; for(i=10;i<=T;i++)
2016-05-24 23:24:09
4535
原创 5-21 求特殊方程的正整数解 (15分)
#include #include #include #include #include #include #include using namespace std;int b[10050]= {0};int main(){ memset(b,0,sizeof(b)); int a[120]= {0},N; scanf("%d",&N); fo
2016-05-23 22:07:32
1449
原创 5-20 打印九九口诀表 (15分)
#include#include#include#include#include#include#include#includeusing namespace std;int main(){ int m,n; scanf("%d",&n); for(int i=1; i<=n; i++) { for(int j=1; j<=i;
2016-05-23 22:06:58
830
原创 5-19 支票面额 (15分)
#include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3fint main(){ int n,y,f; int i=0; scanf("%d",&n); for(f=0;f<100;f++) for
2016-05-23 22:06:31
788
原创 5-18 二分法求多项式单根 (20分)
#include #include #include #include #include #include using namespace std;#define INF 0x3f3f3f3ffloat a0,a1,a2,a3;float fun(float t){ float s; s=a3*pow(t,3.0)+a2*pow(t,2.0)+a1*t+a0;
2016-05-23 22:05:53
1327
原创 5-17 爬动的蠕虫 (15分)
#include #include #include #include #include using namespace std;int main(){ int N,U,D,time=0,H=0; scanf("%d%d%d",&N,&U,&D); while(1) { H+=U; time++; if
2016-05-23 22:05:26
1471
原创 5-16 求符合给定条件的整数集 (15分)
#include#include#include#include#include#include#include#includeusing namespace std;int main(){ int a,b,c,d; scanf("%d",&a); b=a+1; c=a+2; d=a+3; printf("%d%d%d %d%d
2016-05-23 22:04:58
1327
计算几何模板
2018-09-16
蚁群、粒子群、GA、TS等算法解决Job shop问题matlab源码(附test文件)
2018-09-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人