- 博客(8)
- 资源 (1)
- 收藏
- 关注
原创 A. Vasya and Socks
Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them a...
2018-05-20 11:34:09 191
原创 独木舟
n个人,已知每个人体重。独木舟承重固定,每只独木舟最多坐两个人,可以坐一个人或者两个人。显然要求总重量不超过独木舟承重,假设每个人体重也不超过独木舟承重,问最少需要几只独木舟? Input 第一行包含两个正整数n (0<n<=10000)和m (0<m<=2000000000),表示人数和独木舟的承重。接下来n行,每行一个正整数,表示每...
2018-05-20 10:34:58 843
原创 大数相加(分正负数)
给出2个大整数A,B,计算A+B的结果。 Input 第1行:大数A第2行:大数B(A,B的长度 <= 10000 需注意:A B有可能为负数) Output 输出A + B Sample Input 68932147586468711654886 ...
2018-05-16 22:50:26 892
转载 C语言实现大数相加相减和相乘
首先是字符串翻转函数,大数相加、相减和相乘中都用到了这个函数[cpp] view plain copy /* ** 字符串翻转 */ void Reverse(char *str, int n) { int i; for (i = 0; i < n / 2; i++) { char tmp; tmp = str[i];...
2018-05-15 20:58:39 1688 1
原创 Least Common Multiple
Problem Description The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15...
2018-05-10 16:19:50 94
转载 Big Number
Problem Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are g...
2018-05-10 13:11:22 72
原创 NYOJ 阶乘因式分解(二)
阶乘因式分解(二) 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 给定两个数n,m,其中m是一个素数。 将n(0<=n<=2^31)的阶乘分解质因数,求其中有多少个m。 注:^为求幂符号。 输入第一行是一个整数s(0<s<=100),表示测试数据的组数随后...
2018-05-05 21:29:30 134
转载 三角形顺时针和逆时针的判定
利用矢量叉积判断是逆时针还是顺时针。 设A(x1,y1),B(x2,y2),C(x3,y3),则三角形两边的矢量分别是: AB=(x2-x1,y2-y1), AC=(x3-x1,y3-y1) 则AB和AC的叉积为:(2*2的行列式) |x2-x1, y2-y1| |x3-x1, y3-y1| 值为:(x2-x1)*(y3-y1) - (y2-y1)*(x3-x1...
2018-05-05 20:08:13 1697
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人