上一页 1 ··· 9 10 11 12 13 14 下一页
  2012年4月4日
摘要: //java大数import java.util.Scanner;import java.math.BigInteger;public class NF{ public static void main(String args[]) { int n; Scanner cin = new Scanner(System.in); BigInteger sum; while (cin.hasNextInt()) { n = cin.nextInt(); sum = new B... 阅读全文
posted @ 2012-04-04 13:51 Try86 阅读(197) 评论(0) 推荐(0)
摘要: //模拟#include <cstdio>#include <cstring>#include <iostream>using namespace std;char str[10001];void solve() { int l = strlen(str); int c = 1; char ch = str[0]; for (int i=1; i<l; ++i) { if (ch == str[i]) ++c; else { if (c > 1) printf ("%d%c", c, ch); el... 阅读全文
posted @ 2012-04-04 11:43 Try86 阅读(143) 评论(0) 推荐(0)
摘要: //数论,gcd & lcm相关//该题有只有一个数据的测试组#include <cstdio>#include <iostream>int gcd(int a, int b) { return b ? gcd(b, a%b) : a;}int lcm(int a, int b) { return a / gcd(a, b) * b;}int main() { int t; scanf ("%d", &t); while (t--) { int n, a, b, i; scanf ("%d%d", &n, 阅读全文
posted @ 2012-04-04 11:34 Try86 阅读(128) 评论(0) 推荐(0)
摘要: 编辑器加载中/*由斯特林[striling]公式可得: lnN!=NlnN-N+0.5ln(2N*pi) log10(N!)=lnN!/ln(10) 一个数字的位数,由对数来求。log10() // 求以10为底的对数log() // 以e为底的对数*///数学题#include <cmath>#include <cstdio>#include <iostream>using namespace std;const double PI = 3.14159265;int main() { int t; scanf ("%d", &t 阅读全文
posted @ 2012-04-04 11:01 Try86 阅读(138) 评论(0) 推荐(0)
摘要: //数学题#include <cstdio>#include <iostream>using namespace std;int gcd(int a, int b) { return b ? gcd(b, a%b) : a;}int main() { int n, m; while (scanf("%d%d", &n, &m) != EOF) { printf ("%10d%10d", n, m); if (gcd(n, m) == 1) printf (" Good Choice\n\n"); 阅读全文
posted @ 2012-04-04 10:14 Try86 阅读(153) 评论(0) 推荐(0)
摘要: //数学题,循环周期为9#include <cstdio>#include <cstring>#include <iostream>using namespace std;char n[1005];int main() { while (scanf("%s", &n), strcmp(n, "0")!=0) { int sum = 0; int l =strlen(n); for (int i=0; i<l; ++i) { sum += n[i] - '0'; sum %= 9; } .. 阅读全文
posted @ 2012-04-04 09:58 Try86 阅读(129) 评论(0) 推荐(0)
摘要: //模拟,注意题中没有给出数据的大小#include <cstdio>#include <cstring>#include <iostream>using namespace std;char n[1005];int solve() { int sum = 0; int l = strlen(n); for (int i=0; i<l; ++i) sum += n[i] - '0'; if (sum > 9) { int s, m; s = m = sum; sum = 0; while (s > 9) { ... 阅读全文
posted @ 2012-04-04 09:44 Try86 阅读(129) 评论(0) 推荐(0)
摘要: //简单数学题#include <cstdio>#include <iostream>using namespace std;int main() { int i; double s, sum; printf ("n e\n"); printf ("- -----------\n"); printf ("0 1\n"); printf ("1 2\n"); printf ("2 2.5\n"); printf ("3 2.666666667\n"); 阅读全文
posted @ 2012-04-04 09:09 Try86 阅读(165) 评论(0) 推荐(0)
摘要: //贪心,比例从大往后贪#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;struct node { double j; double f; double c;}s[100000];int cmp(const void *a, const void *b) { node *c = (node *)a; node *d = (node *)b; if (c->c > d->c) return -1; return 1;}int main() { 阅读全文
posted @ 2012-04-04 08:50 Try86 阅读(154) 评论(0) 推荐(0)
摘要: //简单数学题#include <cstdio>#include <iostream>using namespace std;int main() { int n; while (scanf("%d", &n), n) { int time = 0; int one, two; one = 0; for (int i=0; i<n; ++i) { scanf ("%d", &two); if (one < two) time += (two - one) * 6; ... 阅读全文
posted @ 2012-04-04 08:20 Try86 阅读(185) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 下一页