- 博客(17)
- 收藏
- 关注
原创 usaco-lgame
首先过滤字典,把不符合要求的字典单词都pass掉,然后对字典进行两两组合再进行判断,就OK 了,有些细节要把握好。觉得有点丑的代码#include #include #include #include #include #define zout fout#define maxn 40000using namespace std;ifstream fin("lgame.in"
2012-12-31 11:57:41 416
原创 usaco--race3
木有参考题解,第一问蛮简单的,数据小,暴力过。第二问看了题解也还是不明白,就自己想了,参考刘汝佳求无向图割点的pre数组,只不过这道题的pre数组用宽搜求出,至于为什么,哥给不出证明,只能在脑袋里想想是对的,这种感觉很无奈的。枚举第一问得到的答案的每个点,假设这个点是C(不明白指代的看代码),从C点开始往下深搜,如果又搜回到了C点,而且中途经过的点最小pre值小于C点的pre值,C点就不是
2012-12-30 16:23:14 495
原创 android里面sqlite简单运用
sqlite是android提供的一个本地小型数据库,方便易用,但不宜过度依赖。使用SQLiteDatabase db定义一个数据库对象db,但是需要自习实现一个SQLiteOpenHelper类,文档是这么定义SQLiteOpenHelper的A helper class to manage database creation and version management
2012-12-29 18:43:12 500
原创 usaco--prime3
终于搞出来了,只能说,真的好变态。。。。。。题解还是参考NOCOW,这里不赘述了,最后一组数据好危险,想了想其实后面还可以再剪枝优化一下,中间搜索的时候加上一个检查,如果行列和对角线任意一处的和大于了题目给出的SUM就可以减掉。这是不加中途检查的resultExecuting... Test 1: TEST OK [0.032 secs, 6004 KB] Test 2
2012-12-27 16:24:36 453
转载 关于Activity02的setOnClickListener报错
Activity02.java中正确代码为:package cre.activity;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.widget.*;public class
2012-12-19 11:47:34 895 1
原创 usaco--buylow
求一个最长的递减序列,要求长度,和不一样的解的个数#define zout fout#define debug#define maxn 5020using namespace std;typedef long long Long;ifstream fin("buylow.in");ofstream fout("buylow.out");struct bignum{ int a
2012-12-17 23:25:38 336
原创 usaco-cowcycle
#include#include#include#include#define maxn 11#define zout foutusing namespace std;ifstream fin("cowcycle.in");ofstream fout("cowcycle.out");int n,m;int a[maxn],b[maxn];int f1,f2,r1,r2;in
2012-12-17 00:09:54 420
原创 usaco--job
没有nocow这题起码得写一个月,,,#include#include#include#define maxn 1200using namespace std;ifstream fin("job.in");ofstream fout("job.out");int n,m[2];int t[2][100];int de[100],ct[2][maxn];void init()
2012-12-14 22:43:29 433
原创 帮同学写的C++大作业,图书管理系统
#include#include#include#include#include#include#include#include#include#include#define debugusing namespace std;string choice="2";time_t timep;struct tm *p;bool logined=0; const int m
2012-12-12 23:24:41 9650 2
转载 C语言中获取当前系统时间
#include #include #include #include int main(){ time_t timep; char s[30]; time(&timep); strcpy(s,ctime(&timep)); printf("%s\n", s);}#include #include int main(){
2012-12-12 19:40:14 774
原创 usaco--stall4
还是可耻的扔模板using namespace std;ifstream fin("stall4.in");ofstream fout("stall4.out");int pre[maxn];bool vis[maxn];bool g[maxn][maxn];int n,m;void init(){ fin>>n>>m; memset(g,0,sizeof(g));
2012-12-12 18:10:37 371
原创 usaco-dith
可耻的把模板扔上去就过了#include#include#include#include#include#include#define maxn 220#define INF 0x7fffffffusing namespace std; int cap[201][201],flow[201][201],a[201]; //cap[][]表示最大容量,flow[][]表
2012-12-12 18:09:31 388
原创 usaco--cryptcow
照着nocow上的题解优化,一步一步的来,可耻的欺骗了第八组数据,目测是因为hash函数的问题,从昨天下午下了体育课回寝室开始写,一直debug到晚上睡觉,中间重写了一遍,蛮喜欢这样充实的日子,今天中午回来cheat了一组数据就过了,可耻啊可耻。。。。。。Executing... Test 1: TEST OK [0.000 secs, 3460 KB] Test 2: T
2012-12-11 12:30:09 342
原创 usaco --fence6
#define maxn 100000000using namespace std;ifstream fin("fence6.in");ofstream fout("fence6.out");int v[120],e[2][120][10];int n;void init(){fin>>n;int c;for(int i=0;i{fin>>c;f
2012-12-08 23:19:34 403
原创 usaco--fence8
题解见nocow,学到的二分答案搜索挺有用的,然后就是搜索的剪枝技巧,下面见代码~~#include#include#include#include#includeusing namespace std;int n,m,b[60],tb[60],r[1300];int sum,sumr[1300],sp,mid;ifstream fin("fence8.in")
2012-12-07 21:50:53 413
原创 POJ --1204--Word Puzzle
题目大意:给出一个字符矩阵,在给出r个单词,找出这些单词在矩阵中出现的坐标和方向由于数据规模的关系,直接搜索肯定是不行滴,。借助TRIE数据结构可以过掉,具体思路:枚举矩阵中的每一个位置和每一个方向,如果从该方向搜下去的字符出现trie树中的话就继续往下,如果trie树中没有的话,就break掉代码:写的还是蛮清楚的嘛#include #include #define maxnod
2012-12-06 19:58:36 477
转载 python 发邮件
# 导入 smtplib 和 MIMEText import smtplib from email.mime.text import MIMEText # 定义发送列表 mailto_list=["xxx@qq.com","yyy@qq.com"] # 设置服务器名称、用户名、密码以及邮件后缀 mail_host = "smtp.126.com" mail_
2012-12-02 12:06:36 542
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人