摘要: 水题~~题意:满足方程 a*x1*x1+b*x2*x2+c*x3*x3+d*x4*x4=0 的解的个数直接模拟三个for即可View Code 1 #include<stdio.h> 2 #include<math.h> 3 int main(){ 4 int a,b,c,d; 5 while( scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF ){ 6 int ans=0; 7 if(( a>0&&b>0&&c>0&&d>0 阅读全文
posted @ 2013-02-16 21:43 xxx0624 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题意:三个瓶子,容量为s,n,m,且s装满饮料 s=m+n求至少倒多少下能使得某两个瓶子装着相同多的饮料。bfs 模拟View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int maxn = 105; 8 struct node{ 9 int s,n,m,t; 10 }; 11 int s,n,m; 12 i 阅读全文
posted @ 2013-02-16 21:21 xxx0624 阅读(1411) 评论(0) 推荐(0) 编辑
摘要: 题意:从一个4位数到另一个4位数 所需的步数bfsView Code 1 #include<stdio.h> 2 #include<string> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 #include<iostream> 7 #include<map> 8 using namespace std; 9 const int maxn = 10;10 char a[maxn],b[maxn];11 int vis[ 10000 阅读全文
posted @ 2013-02-16 10:39 xxx0624 阅读(357) 评论(0) 推荐(0) 编辑