
C语言做题
吴_大_鹏
尽信书则不如,已上内容,纯属一家之言,因个人能力有限,难免有疏漏和错误之处,如发现bug或者有更好的建议,欢迎批评指正,不吝感激,QQ:1419914659
展开
-
poj1061青蛙那啥,第一次弄欧几里德,各种问题各种请教
#include__int64 e_gcd(__int64 a,__int64 b,__int64 &x,__int64 &y) { if(b==0) { x=1; y=0; return a; } __int64 ans=e_gcd(b,a%b,x,y); __int64原创 2015-07-30 19:59:34 · 318 阅读 · 0 评论 -
HDU 5198 水 c语言
http://acm.hdu.edu.cn/showproblem.php?pid=5198 坑死我了,一个多小时啊,只有三中字母,不多不少,每一个都是1/3长度,这些条件都满足就YES#include<stdio.h>#include<string.h>int main(){ char arr[1000]; int i,size,flag,num; while(sc原创 2015-11-15 11:39:44 · 354 阅读 · 0 评论 -
There is a board with
There is a board with 100 * 100 grids as shown below. The left-top gird is denoted as (1, 1) and the right-bottom grid is (100, 100). We may apply three commands to the board:WHITE x, y, L // Pai原创 2015-10-13 21:57:45 · 573 阅读 · 0 评论 -
A Sweet Journey
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 0 Accepted Submission(s): 0Problem Description Master Di plans to take his girlfriend for a原创 2015-10-13 21:56:10 · 286 阅读 · 0 评论 -
NOJ 5538 c语言
二维坐标建立的时候从1开始存,把图的周围全变成0方便计算#include<stdio.h>int n , m,arr[1002][1002];int Map(int x,int y){ int sum=0; if(arr[x][y] == 0) return sum; else { if(arr[x][y]-arr[x-1][y]原创 2015-11-09 19:53:12 · 576 阅读 · 0 评论 -
NOJ 5533 c语言
点的坐标加起来求中点,算输入的点到中点的距离,都相等就输出YES#include<stdio.h>#include<math.h>double x,y;double brr[101];int main(){ int T,n,i,num,arr[101][2]; scanf("%d",&T); while(T--) { x=0;y=0;num=原创 2015-11-09 19:51:45 · 500 阅读 · 0 评论 -
跑马
A Sweet JourneyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionMaster Di plan原创 2015-09-28 20:18:44 · 295 阅读 · 0 评论 -
poj1321c语言棋盘简单深搜
这个题确实有点简单,看清楚不能同列同行就好了,用一个一维数组标记哪一列用了往下搜就好了#includeint flag[8]={1,1,1,1,1,1,1,1},i,j,n,k,num=0;char arr[10][11];void dfs(int a,int b){ int ii,jj; if(b==0) { num++; return ; } for(ii=a+1;i原创 2015-08-16 21:12:21 · 1006 阅读 · 0 评论 -
poj1979广搜c语言
坑了,写程序的时候倒数第二个花括号把return 0;给我括起来了,程序一次就结束了,吃了饭回来才顿悟了#includestruct point{ int hang,lie; int predecessor;}queue[402],p,visit_point;char brr[30][30],c;int head=0,tail=0,n,m;void enqueue(struct p原创 2015-08-17 15:09:49 · 799 阅读 · 0 评论 -
poj3984广搜c语言
#include //输入5*5迷宫,输出路径#define MAX_ROW 5 #define MAX_COL 5 struct point { int row, col, predecessor; } queue[512],p; struct node{int x,y;}arr[50];int head = 0, tail = 0; void enqueue(struct原创 2015-08-17 00:22:28 · 724 阅读 · 0 评论 -
poj2386C语言解题报告
#includechar mi[1000][1000];int arr[1000][1000];void dfs(int x,int y){// if(arr[x+1][y]=='W'||arr[x+1][y+1]=='W'||arr[x-1][y]=='W'||arr[x-1][y-1]=='W'||arr[x][y+1]=='W'||arr[x][y-1]=='W'||arr[x+1原创 2015-08-12 16:29:10 · 701 阅读 · 0 评论 -
poj2393解题报告c语言
#include #define maxn 10001 int n,s;__int64 ans=0;int min(int a,int b){ if(a>b) return b; else return a;}int y[maxn],c[maxn];int main(){ int i; while(~scanf("%d%d",&n,&s)&&n!=0)原创 2015-08-12 16:27:31 · 454 阅读 · 0 评论 -
poj3253解题报告c语言
#include #define INF 50001__int64 heap[INF],arr[INF], size = 0;void push(__int64 x){ __int64 i = size++; while(i > 0){ __int64 j = (i - 1) / 2; if(heap[j] x) break; heap[i] = heap[j]; i原创 2015-08-12 16:25:58 · 508 阅读 · 0 评论 -
HDU 5310 题意 c语言代码
题意大概是给你n个人,一套纪念品有m个,买一个纪念品的价格p和买一套的价格q,让每个人都有,自己最少花多少钱原创 2015-11-22 10:37:43 · 265 阅读 · 0 评论