摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 100005int step, mod;bool vis[maxn];int generate(int step, int mod){ memset(vis, 0, sizeof(vis)); int x = 0; int ret = 0; while (!vis[x]) { vis[x] = true; ... 阅读全文
posted @ 2013-01-18 16:52
undefined2024
阅读(160)
评论(0)
推荐(0)
摘要:
素数筛View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <cmath>using namespace std;#define maxn 1005#define maxm 1005bool is[maxn];int prm[maxm];int n, m;int sum[maxn];int getprm(int n){ int i, j, k = 0; int s, e = (int) (sqrt(0.0 + 阅读全文
posted @ 2013-01-18 16:39
undefined2024
阅读(272)
评论(0)
推荐(0)
摘要:
最短路变形View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 505#define maxm maxn * maxn#define inf 0x3f3f3f3fstruct Edge{ int v, w, next;}edge[maxm];int n, m;int head[maxn];int edge_num;int q[maxn];int dist[maxn];boo 阅读全文
posted @ 2013-01-18 16:03
undefined2024
阅读(317)
评论(0)
推荐(0)
摘要:
高精度View Code import java.util.*;import java.math.*;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); BigInteger a = cin.nextBigInteger(); BigInteger sum = BigInteger.ZERO; while (!a.equals(BigInteger.ZERO)) { ... 阅读全文
posted @ 2013-01-18 14:22
undefined2024
阅读(270)
评论(0)
推荐(0)
摘要:
简单题View Code #include<iostream>#include<iomanip>#include<cmath>#include<string>using namespace std;char level[3][20]={"DEFICIENT","PERFECT","ABUNDANT"};char a[1000];void output(int n){ int i; int mid=n/2; int sum=1; for(i=2;i<=mid;i++) { if(n% 阅读全文
posted @ 2013-01-18 14:13
undefined2024
阅读(202)
评论(0)
推荐(0)
摘要:
基础计算几何View Code //zju1280#include <iostream>#include <cstdio>using namespace std;struct Point{ double x,y;};class Line{public: Point pointa,pointb,pointk; void makeline(Point pointa,Point pointb);};void Line::makeline(Point a,Point b){ pointa=a; pointb=b; pointk.x=pointa.x... 阅读全文
posted @ 2013-01-18 14:08
undefined2024
阅读(455)
评论(0)
推荐(0)
摘要:
java中StringBuffer类似于C++中的String,append函数可以在其后面添加字符,reverse可以反转。java中BigInteger的intValue方法可以将其转为int。View Code import java.io.*;import java.util.*;import java.math.*;public class Main { final static int maxl = 50; static String translate(String temp) { StringBuffer ret = new StringBuff... 阅读全文
posted @ 2013-01-18 13:49
undefined2024
阅读(203)
评论(0)
推荐(0)
摘要:
栈模拟View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <stack>using namespace std;#define maxn 1005int n;int f[maxn];void input(){ for (int i = 1; i < n; i++) scanf("%d", &f[i]);}bool ok(){ stack<int> stk; in 阅读全文
posted @ 2013-01-18 11:11
undefined2024
阅读(444)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 55int n;int f[maxn];int main(){ //freopen("t.txt", "r", stdin); int t = 0; while (scanf("%d", &n), n) { for (int i = 0; i &l 阅读全文
posted @ 2013-01-18 10:52
undefined2024
阅读(281)
评论(0)
推荐(0)
摘要:
递推View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 15#define maxk 1005#define maxd 35#define inf 0x3f3f3f3fint n, m;int f[maxn][maxk];int flight_num[maxn][maxn];int flight[maxn][maxn][maxd];void input(){ for (i 阅读全文
posted @ 2013-01-18 10:35
undefined2024
阅读(153)
评论(0)
推荐(0)

浙公网安备 33010602011771号