题目链接:BZOJ - 2186题目分析题目要求出 [1, n!] 中有多少数与 m! 互质。(m #include #include #include #include #include using namespace std;typedef long long LL;const int MaxN...
分类:
其他好文 时间:
2015-04-07 09:40:37
阅读次数:
171
最少的交换最少的交换题目描述现在给你一个由 n 个互不相同的整数组成的序列,现在要求你任意交换相邻的两个数字,使序列成为升序序列,请问最少的交换次数是多少?输入格式输入包含多组测试数据。每组输入第一行是一个正整数 n(nusing namespace std;const int maxn = 500...
分类:
其他好文 时间:
2015-04-07 09:36:33
阅读次数:
1014
题目大意:给出一个m行n列的数组,元素只有0和1,问:能不能找出几行,使得每一列都有且仅有一个1.分析:直接深搜即可#include#includeusing namespace std;int vis[311];//记录该列有1没int n, m;int a[20][311];bool flag;...
分类:
其他好文 时间:
2015-04-07 01:58:23
阅读次数:
130
//链表线性存储#includeusing namespace std;class Date{public: int date; Date*next;};void show(Date*head); //显示函数Date*creat(); ...
分类:
其他好文 时间:
2015-04-07 00:26:51
阅读次数:
150
【题意】
给定序列q[1..n],求任意两数异或的最大值
数据范围:1
【分析】Trie用来从高到低保存0和1,然后爆搜:尽可能凑1,不然凑0
【代码】
WOC为什么是多组数据?
#include
#include
#include
using namespace std;
const int K=32;
const int L=3300000;
typedef long...
分类:
其他好文 时间:
2015-04-06 23:16:51
阅读次数:
178
比赛链接:click here~~
A BNU ACM校队时间安排,模拟自能
手速题:
#include
#include
#include
#include
#include
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int tmp...
分类:
其他好文 时间:
2015-04-06 23:16:37
阅读次数:
197
仅仅记录贴,按书上的做完了一边,想把private分离出来已经很难了。因为is用到的成员变量都是直接当做public使用的,如果要改的话可以考虑存储输入,让后用构造函数对类进行初始化。#includeusing namespace std;class Sales_data{public: stri....
分类:
编程语言 时间:
2015-04-06 23:12:15
阅读次数:
195
题意:
给一个数n,求有多少种和为n的单峰先增序列,比如当n=5时结果为3:(5), (1 3 1), (1 1 1 1 1)。
分析:
转化为求类似整数拆分问题,f(i,j)的意义是把i进行拆分,最大数小于等于j的方法数。
代码:
//poj 1221
//sep9
#include
using namespace std;
const int maxN=300;
__int64 a...
分类:
其他好文 时间:
2015-04-06 21:57:14
阅读次数:
118
#include
#include
#include
#define MAXN 21
using namespace std;
char str[MAXN];
int main()
{
cin>>str;
for(int i = 0; i
{
if(islower(str[i]))
str[i] = toupper(str[i]);
else if(isupper...
分类:
其他好文 时间:
2015-04-06 21:53:56
阅读次数:
133
链接:click here~~
题意:
题目大致意思是一个虫子掉在了一个n长度深的井中,然后它每分钟可以爬u长度,然后要休息一分钟,在此期间它会掉下d长度,问最终爬出井需要多久。
简单模拟:
代码:
#include
#include
#include
#include
#include
using namespace std;
int main()
{
int...
分类:
其他好文 时间:
2015-04-06 21:51:17
阅读次数:
196