using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Queue
{
private int font = 0;
...
今天想写个宏定义,发现宏定义里也可以写不定参数,但是我的宏最终没有用。
因为我觉得写完,这个不定参数给我带来的麻烦,比好处好想多。
因此我就定义了两个宏,用一个宏定义另一个。
把今天这个c++的类型不确定和参数个数不确定的用法先记下来。以备后用啊。
直接代码:
#include // 必备头文件
#include
using namespace std;
typed...
分类:
编程语言 时间:
2015-03-11 21:46:11
阅读次数:
148
题意:
N,个点,M条路,W个虫洞,虫洞的边就是负的
如果出现负环代表YES
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define maxn 1000
const int INF = 1111111111;
int N,M,...
分类:
其他好文 时间:
2015-03-11 21:45:19
阅读次数:
117
#include
#include
using namespace std;
int ai(const char *p){
bool negflag = false;
int rs = 0;
if(*p=='+'||*p=='-'){
negflag=(*p=='-');
p++;
}
while(isdigit(*p)){
rs=rs*10+(*p-'0');
p++;...
分类:
其他好文 时间:
2015-03-11 21:43:30
阅读次数:
143
题意:求从出发点到每个车站的最短距离+从每个车站回到出发点的最短距离是多少
思路:如果从每个点到出发点求一次最短路10^5个点10^5次求SPFA也会超时,那么如果我们反向建边的话可以只用一次SPFA,因为是单向边嘛,把箭头反过来,再求一次起点到各点的最短距离不就行了?
#include
#include
#include
using namespace std;
const int inf ...
分类:
其他好文 时间:
2015-03-11 21:42:37
阅读次数:
141
#include
#include
#include
#include
using namespace std;
const int Max_v = 1000 + 10;
const int INF = 9999999;
int cost[Max_v][Max_v];//权值
int d[Max_v];//顶点s出发最短距离
bool used[Max_v];//以使用过的图
int V...
分类:
其他好文 时间:
2015-03-11 21:41:42
阅读次数:
174
题意:n个节点的树,每个点有一种颜色。现有m种询问,每次询问x y a b表示x到y的路径上颜色的种数且a颜色看成b颜色。(nusing namespace std;const int N=50005;int ihead[N], cnt, id[N], blo[N], f[N][16], dep[N...
分类:
移动开发 时间:
2015-03-11 21:35:42
阅读次数:
205
#include#include#includeusing namespace std;typedef struct link{ int num; struct link *next;}IA;IA *Create();IA *Insert (IA *head, IA *p);void P...
分类:
编程语言 时间:
2015-03-11 21:19:43
阅读次数:
108
这题不会,水平太次,把问题转换为程序的能力太弱了,不知道哪方面不足。直接copy的最优代码: #include#includeusing namespace std;//存储20000以内的阶乘int a[15470]; //用数组来存储结果,每个元素存一个五位数int main(){ ...
分类:
其他好文 时间:
2015-03-11 21:18:35
阅读次数:
183
用一个数组保存出现的字符串即可,数量用一个整形数组保存。
#include
using namespace std;
int main()
{
char a[1001][20],b[20];
int c[1001];
int n,i,k,j,sum,sumpos;
bool find;
while(cin>>n && n)
{
getchar();
memset(c,0...
分类:
其他好文 时间:
2015-03-11 19:50:03
阅读次数:
141