暴搜一下就行了,确实也没法优化什么。 不过枚举一半,另一半用next_permutation()函数应该是会快一些的。
#include
#include
#include
#include
#include
#include
using namespace std;
int T,a[20],n,vis[20],tot;
int A[20],B;
void dfs(int cur) {
...
分类:
其他好文 时间:
2015-04-14 16:44:14
阅读次数:
141
本来以为会超时,看来是想多了,63ms,看来对时间复杂度的判断能力还是不行啊。这个题正是next_permutation()函数的用武之地。
#include
#include
#include
#include
#include
#include
using namespace std;
int n,sum,a[100],A[100];
int main() {
scanf("%d%d...
分类:
其他好文 时间:
2015-04-14 16:37:55
阅读次数:
112
这套题分别在总结3313~3321A.水B.大模拟,敲了好长时间。。。#include#include#includeusing namespace std;char str[35][1000] = {"111111MMM11111111MMMMMMMMMMM111111111MMMMMMMM111...
分类:
其他好文 时间:
2015-04-14 16:12:40
阅读次数:
132
// 111.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include using namespace std;class Person{private: string m_strName;public: Person(string str...
分类:
其他好文 时间:
2015-04-14 15:58:33
阅读次数:
133
题意 中文
动态区间和问题 只会更新点 最基础的树状数组 线段树的应用
树状数组代码
#include
using namespace std;
const int N = 50005;
int c[N], n, m;
void add(int p, int x)
{
while(p <= n)
c[p] += x, p += p & -p;
}
int...
分类:
编程语言 时间:
2015-04-14 14:46:01
阅读次数:
147
题意 动态查询第K大的数
用小数在前优先队列维护K个数 每要插入一个数时 若这个数小于队首元素那么就不用插入了 否则队首元素出队 这个数入队 每次询问只用输出队首元素就行了
#include
#include
using namespace std;
int main()
{
int n, a, k;
char op[5];
while(~scanf("%d%...
分类:
其他好文 时间:
2015-04-14 14:45:18
阅读次数:
175
一开始还在想去重的问题,结果发现后台数据貌似没有重复的情况= =
/*
ID: 18906421
LANG: C++
PROG: milk3
*/
#include
#include
#include
#include
using namespace std;
const int maxn = 25;
int vis[maxn][maxn][maxn] = {0};
vectorans;
int...
分类:
其他好文 时间:
2015-04-14 14:40:36
阅读次数:
151
01作业using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;namespace _01var作业推断类型{ class Progra...
分类:
其他好文 时间:
2015-04-14 14:20:46
阅读次数:
119
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;namespace _05foreach使用{ class Program ...
分类:
其他好文 时间:
2015-04-14 14:19:56
阅读次数:
97