摘要:
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1266View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 long long int a[21]; 5 long long int zhan[21]; 6 int main() 7 { 8 int i,j,n,t,x; 9 long long int s; 10 scanf("%d",& 阅读全文
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2965View Code 1 #include<iostream> 2 using namespace std ; 3 int main() 4 { 5 int a[100] = {0,7,27,70,70,70,70,70,70,70,70,270 } ; 6 int t, i, p ; 7 cin>>t ; 8 for(i=12; i<100; i++) 9 a[i] = 700 ;10 while(t--)11 ... 阅读全文
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2966prim:View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int INF = 1<<28 ; 4 #define maxn 510 5 int map[maxn][maxn], dis[maxn], visited[maxn] ; 6 int main() 7 { 8 int t, a, b, k, n, e, minco, min ; 9 int i, j ; 阅读全文
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2969610MS :View Code 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int t; 6 cin>>t; 7 for(int i = 1; i <= t; i++) 8 { 9 int n;10 cin>>n;11 for(int j = 0, num; cin>>num && j< n; j++)... 阅读全文
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2970View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char s[20] ; 6 int t, i, n, a[2010] ; 7 scanf("%d", &t) ; 8 while(t--) 9 {10 scanf("%s", s) ;11 scanf("%d", &n) ;12 阅读全文
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2971View Code 1 #include<iostream> 2 #include<map> 3 #include<string.h> 4 using namespace std ; 5 map<string, int>a ; 6 string s ; 7 void init() 8 { 9 a["zero"] = 0 ;10 a["one"] = 1 ;11 a["t 阅读全文
摘要:
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1150View Code 1 #include<iostream> 2 #include<cmath> 3 using namespace std ; 4 int a[2000000], b[2000000] ; 5 int n ; 6 int main() 7 { 8 int i, j, t, num, q ; 9 cin>>n ;10 t = sqrt(n) ;11 num = 0 ;12 for(i=2 阅读全文
摘要:
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1463View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 int main() 6 { 7 char c[105]; 8 int flag=0; 9 while(cin>>c)10 {11 flag=0;12 for(int i=0;i<strl.. 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1879prim:View Code 1 #include <iostream> 2 #include <cmath> 3 4 using namespace std; 5 #define MAX 99999 6 #define LEN 101 7 int dist[LEN]; 8 int map[LEN][LEN]; 9 bool isvisited[LEN]; 10 11 //初始化 12 void init(){ 13 int i,j; 1... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1875kruskal算法: 140MSView Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<math.h> 4 struct node 5 { 6 int x, y ; 7 double z ; 8 }b[6000] ; 9 int set[101], i ;10 double sum ;11 int cmp(const void *a, const void *b)12 {13 struct node 阅读全文