随笔分类 - HDUACM
一些acm题目解答
摘要:#include <stdio.h> int gcd(int a, int b){ int t; while(t=a%b) { a=b; b=t; } return b;} int main(void){ int t,m,n,i,g,lcm; scanf("%d",&t); while(t--) {
阅读全文
摘要:#include <stdio.h>#include <math.h> int main(void){ int t,n,i; double sum; scanf("%d", &t); while(t--) { scanf("%d",&n); sum=0; for(i=2;i<=n;i++) sum+
阅读全文
摘要:#include <stdio.h> int judge(int a, int b, int m){ return (a*a+b*b+m)%(a*b)==0;} int count(int m, int n){ int i,j,c; c=0; for(i=1;i<n;i++) { for(j=i+1
阅读全文
摘要:#include <stdio.h>#include <string.h> int prime[38]={0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1};int visit[21]={0,0,0
阅读全文
摘要:#include <stdio.h>#include <string.h>#include <stdlib.h> int cmp(void* a, void* b){ return *((char*)a)-*((char*)b);} void solve(int t, char* dic){ int
阅读全文
摘要:#include <stdio.h> int gcd(int a, int b){ int t; while(t=a%b) { a=b; b=t; } return b;} int main(void){ int s,m,i; while(scanf("%d %d", &s, &m)!=EOF) {
阅读全文
摘要:#include<stdio.h> #include<string.h> int main() { char num[1000]; int len,sum,i; while(scanf("%s",&num)!=EOF) { len=strlen(num); if(len==1 && num[0]==
阅读全文
摘要:#include<iostream>#include<stdio.h> using namespace std; int jiechen(int n){ int i; int ans=1; for(i=1;i<=n;i++) ans*=i; return ans;} int main(){ int
阅读全文
摘要:/*比较苦逼的树形DP,慢慢来吧!不着急*/#include <iostream>#include <vector>using namespace std;const int SIZE = 105; int roomNumber, trooperNumber;int cost[SIZE], brai
阅读全文
摘要:#include <stdio.h>#include <string.h>#include <math.h> int n,m,t;char map[10][10];int flag;int di,dj,wall;int to[4][2] = {{0,-1},{0,1},{-1,0},{1,0}};
阅读全文
摘要:#include <stdio.h>#include <algorithm>using namespace std; struct Node{ double j,f,p;} node[10000]; int cmp(Node x,Node y){ return x.p>y.p;} int main(
阅读全文
摘要:/**最近点对的问题*/ #include #include #include using namespace std;const int SIZE = 100005;const int L = -1;const int R = 1; typedef struct{int index;double
阅读全文
摘要://c++// #includeusing namespace std;int main(){int n,j,t,start;while (cin >> n,n){start =0;t = 0;while(n--){cin >> j;if (j>start){t += 6*(j-start);}el
阅读全文
摘要:#include<stdio.h>#includeusing namespace std;#define INF 0x7fffffffdouble D;struct node{double l;double r;}s[3][2];node interval(double a,double b)//解
阅读全文
摘要://c//https://github.com/WEIZIBIN/acm/blob/master/hdu1004.c#include <stdio.h>#include <string.h>int main(){int i, n, j;char s[1005][15];int count[1005]
阅读全文
摘要://c //https://github.com/WEIZIBIN/acm/blob/master/hdu1005.c#include <stdio.h>int main(){int i, result, a, b, j;long n;int f[50] = {0};f[1] = 1;f[2] =
阅读全文
摘要://c++//https://github.com/zzdxfei/hduacm/blob/master/1003.cpp#include #include using namespace std; void ComputeMaxSubstr(const vector& sets,int& max_
阅读全文
摘要://c#include"stdio.h"int main(){int i, j;while(scanf("%d%d", &i, &j) == 2)printf("%d\n", i + j);return 0;} //c++ #include using namespace std;int main(
阅读全文
摘要://c//https://github.com/ssdutyuyang199401/hduacm/blob/master/1002.c#include<stdio.h>#include<string.h>int shu(char a){return (a-'0');}int main(){char
阅读全文
摘要://c#include "stdio.h"int main() {int a = 0, sum = 0;while (scanf("%d", & a) != EOF) {if ((a << 31) >> 31 == 0) {sum = a / 2;sum *= a + 1;printf("%d\n\
阅读全文