推公式得出斐波那契数列
#include
__int64 dp[60];
int main(){
int n;
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
int a,b,T;
scanf("%d",&T);
while(T--){
scanf("%d%d",&a,&b);
if(a>b){...
分类:
其他好文 时间:
2015-04-19 08:55:50
阅读次数:
172
一道后缀数组搞了好几天了,不是TLE就是RE,不是RE就是WA,也是醉了
找点水题来缓解一下郁闷的心情
#include
#include
#include
using namespace std;
int a[105][105],dp[105][105];
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#e...
分类:
其他好文 时间:
2015-04-18 22:03:14
阅读次数:
120
1 #include 2 int main() 3 { 4 int n; 5 long long int a=9,b=1,x,y; 6 int i; 7 //freopen("te.txt","w",stdout); 8 scanf("%d",&n...
分类:
其他好文 时间:
2015-04-11 19:28:20
阅读次数:
116
//必胜局面是所有的黑子和白子都相邻,
//本题想要达到黑子和白子之间都相邻,即走完它们之间的所有空格
//就相当于一个NIM博弈
#include
#include
#include
using namespace std ;
int main()
{
// freopen("in.txt","r",stdin) ;
int n , m ;
int t...
分类:
其他好文 时间:
2015-04-11 14:54:50
阅读次数:
111
就是一简单的完全背包问题,秒杀。代码如下:/*
ID:15674811
LANG:C++
PROG:inflate
*/#include
#include
#include
using namespace std;#define maxn 11000int main()
{
freopen("inflate.in","r",stdin);...
分类:
其他好文 时间:
2015-04-10 18:05:59
阅读次数:
176
题目连接:点击打开链接
解题思路:
暴力
完整代码:
#include
#include
#include
#include
#include
using namespace std;
const int INF = 1000000000;
string s;
int main()
{
#ifdef DoubleQ
freopen("in.txt" , "...
分类:
其他好文 时间:
2015-04-05 13:22:34
阅读次数:
177
例如,想打开“in.txt”,执行如下操作即可
打开:freopen("in.txt", "r", stdin) //读模式
打开:freopen("in.txt", "w", stdin) //写模式
其实令人最头疼的不是这些,而是一旦重定向打开之后,不关闭的话就很痛苦了,但是还是让我找到了...
分类:
其他好文 时间:
2015-04-04 18:30:21
阅读次数:
332
主要涉及字符串操作#include
#include using namespace std;int main(){
freopen("input.txt","r",stdin);
string str;
string str2("ru");
while(cin>>str)
{
int len=str.si...
分类:
Web程序 时间:
2015-04-04 16:49:55
阅读次数:
149
hdu1693Eat the Trees不用分左右插头的DP。关键就是逐格递推。行与行之间的转移看轮廓线发现很happy。 1 int a[13][13]; 2 ll dp[13][13][1<<15]; 3 int main() 4 { 5 freopen("input.txt","r",...
分类:
其他好文 时间:
2015-04-04 12:04:06
阅读次数:
113
【思路】:模拟。不需要结构体,用数组记录就可以。注意,题目中说了学校“从1开始连续编号”。
【AC代码】:
#include
#include
using namespace std;
const int maxn = 100000+10;
int school[maxn];
int main()
{
//freopen("in.txt", "r", stdin);
int n =...
分类:
其他好文 时间:
2015-04-04 09:14:50
阅读次数:
128