题目:
实现一个排序算法,排序对象是本公司员工的年龄,要求时间复杂度O(n),空间复杂度不能超过O(n)。#include
using namespace std;
void SortAge(int Ages[],int length)
{
if (NULL == Ages || length <= 0)
return;
const int ol...
分类:
其他好文 时间:
2015-06-26 12:56:06
阅读次数:
100
题目:给你一些字符,问能组成几个MARGARITA。
分析:简单题。直接统计计算即可。
说明:最近状态有点不稳定╮(╯▽╰)╭。
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
int n,count[6];
char buf[606];
w...
分类:
其他好文 时间:
2015-06-26 12:51:09
阅读次数:
107
在idea中编译时发生如下的错误Information:Using javac 1.7.0_75 to compile java sourcesInformation:java: javacTask: 源发行版 1.6 需要目标发行版 1.6Information:java: Errors occu...
分类:
编程语言 时间:
2015-06-26 12:41:42
阅读次数:
1670
题意:
给定n,求丢番图方程1/x+1/y=1/n(x
分析:
设x=n+a,y=n+b,化简可得n^2=a*b.设n^2的因子个数为p,n^2的所有因子中除n外都是成队出现的,故方程解数为(p+1)/2。
代码:
//poj 2917
//sep9
#include
using namespace std;
int num[64];
int main()
{
int cases,...
分类:
其他好文 时间:
2015-06-26 11:06:06
阅读次数:
95
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u...
1>通过.net提供的类实现 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 using System.Diagnostics; 7 using Sy....
用例: 现在有一个命名空间为Device的Device.dll文件,它含两个类Device1和Device2;现通过反射原理创建Device1和Device2类,具体语句如下://1、首先需要添加引用 using System.Reflection;//2、创建Device1Assembly Asm...
二分匹配
#include
#include
using namespace std;
int k,m,n;
int rem[500+5][500+5];
int map[500+5],visit[500+5];
int dfs(int x)
{
for(int i=1;i<=n;i++)
{
if(rem[x][i]&&!visit[i])
{
visit[i]=1;
...
分类:
其他好文 时间:
2015-06-26 09:27:40
阅读次数:
117
分析:
简单的bfs,但要注意因为输入cases很多,对每个初始状态都搜一遍会超时,其实可以从终止状态反向搜一遍,对搜到的每个状态打表存下即可。
代码:
//poj 3221
//sep9
#include
#include
using namespace std;
int n;
int fac[]={1,1,2,6,24,120,720,5040,40320};
int vis[1...
分类:
其他好文 时间:
2015-06-26 09:27:18
阅读次数:
120
#include
#include
using namespace std;
int * setRow(int rowId, int * lastRow){
int * row = new int[rowId];
row[0] = 1;
for(int i = 1;i < rowId - 1;i++){
row[i]...
分类:
其他好文 时间:
2015-06-26 09:20:20
阅读次数:
96