自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (1)
  • 收藏
  • 关注

原创 java 之网络通信

<br />实现服务器与客户端之间的通信功能:<br />服务端:<br />import java.io.DataInputStream;import java.io.DataOutputStream;import java.net.Socket;public class bb { public static void main(String[] args) { try { for (int i=1;i<=100;i++) { Socket s=

2011-05-29 10:02:00 460

原创 java 之数据库

<br />1,统计有多少记录<br />import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.ResultSetMetaData;import java.sql.Statement;public class k1{ public static void mb_show(ResultSet r) { try {

2011-05-29 09:59:00 471

原创 FOJ1334——Length of Sticks

<br />深搜经典。<br />#include<iostream>#include<string>#include<algorithm>using namespace std;int d[23],stick[23],sum[23];int N,L,K;int ans;bool cmp(int a,int b){ return a>b;}void DFS(int c,int s,int k){ int i; if(s+sum[c]<=ans) re

2011-05-29 09:28:00 432

原创 poj1279——Art Gallery//半平面交 求面积

<br />用上题模板,一次AC。<br />#include<iostream>#include<algorithm>#include<cmath>using namespace std;const int maxn=20010;const int bound=10000;const double esp= 1e-10;class point{public: double x,y;};class node{public: point a,b;

2011-05-19 14:01:00 680

原创 hash查找//hash函数及建表

<br />给定一个序列:abcd,从中间一处断开,然后两段可以自由组合。比如ab-cd  组合有:abcd,abdc,bacd,badc,cdab,cdba,dcab,dcba。类似这样。问有多少种组合。<br />思路:hash来记录状态,模拟。<br />#include<iostream>#include<string>using namespace std;#define maxn 10000class node{public: string st; node *

2011-05-19 01:13:00 485

原创 poj2451——Uyuw's Concert//半平面交

<br /><半平面交>资料详见:朱泽圆06年论文。<br />半平面交思想:<br />1,对半平面预先处理,求极角并排序、去重。<br />2,在凸多边形交里面,根据论文所讲,反复做删去、加入半平面的操作。<br />具体实现,可以参考http://hi.baidu.com/lgq1205/blog/item/8e7a99fb31586b879f514646.html  代码有注释,讲得很好!<br />#include<iostream>#include<algorithm>#include<

2011-05-18 20:58:00 903

原创 多线程程序设计之龟兔赛跑

<br />要求:利用多线程编程编写一个龟兔赛跑程序。乌龟:速度慢,休息时间短;兔子:速度快,休息时间长。<br />class SimpleThread extends Thread{ public int id,st; public SimpleThread(String str) { super(str); if(str.equals("rabbit!!!")) { id=3;st=30;//兔子的话,速度id,休息时间为st~(st+50) }

2011-05-16 15:16:00 6023

原创 Java进程管理

<br />import java.sql.Date;public class c extends Thread{ private int ID; static int sum11; static int sum1; static int sum2; static int sum; public boolean m_done; /** * @param args */ static int [] a=new int[10005]; static i

2011-05-13 11:08:00 2595

原创 STL之multiset应用。

要求:可添加,可删除最大、最小的数,可查询当前最大、最小的数。#include#include#include#includeusing namespace std; int main(){ int a,b;int c,d; int i=0; char ch[4]; scanf("%d%d",&a,&b); getchar(); multiset tree; tree.clear (); multiset::iter

2011-05-12 00:51:00 525

原创 java之图片浏览器

图片在当前工作环境下添加。import java.awt.Container;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFr

2011-05-11 00:38:00 653

原创 poj1942——Paths on a Grid//大数的C(n,m)

组合数学问题,求解c(n,m).数据类型要求甚严。用吉林模板的话,会tle。#includeusing namespace std;double com(double n,double m){ double i; double s(1); if(n>=m-n) n=m-n; for(i=m;i>=m-n+1;i--) { s*=(i/(i-(m-n))); } return s;}int main(){ double n,m; while

2011-05-10 21:02:00 533

原创 poj2602——Superlong sums

<br />果然恶心,用字符串输出才过得了...<br />#include<stdio.h>#define MAX 1000000char a[2][MAX], sum[MAX];int main(){ int n, i; scanf("%d", &n); for(i=0; i<n; i++) { scanf("%d", &a[0][i]); scanf("%d", &a[1][i]); }

2011-05-10 01:22:00 494

原创 poj 2121——Inglish-Number Translator

<br />题意:将英文数字翻译为阿拉伯数字。囧!结束条件忘了判断,贡献两wa。<br />#include<iostream>#include<cstdio>#include<string>using namespace std;char to20[][20]={"zero", "one", "two", "three", "four", "five", "six","seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen

2011-05-09 20:28:00 792

原创 poj1675——Happy Birthday!//atan2求角度

<br />题意:判断能否把三个点划分在圆的三个均等区域内。<br />思路:利用atan2(y,x)求角度,求出的范围为-pi~pi。逆时针的角度为正。判断每两个点之间的夹角是否大于120。这边的夹角指的是两个点之间,能把第三个点包含进去的那个方向。atan()不能计算(0,0)的情况,所以,(0,0)的情况单独判断。<br />#include<iostream>#include<cmath>#include<cstdio>#include<algorithm>using namespa

2011-05-09 18:41:00 1025

原创 poj1661——Help Jimmy//最短路

<br />思路:转化为求最短路。建图比较麻烦,每一个平台拆成两个点,上下两个平台之间距离不超过maxlen的点加边。<br />#include<iostream>#include<cstdio>#include<string>#include<algorithm>using namespace std;#define maxn 2100#define maxcost 99999999int maxlen,sx,sh,n,st,ed;class node{publi

2011-05-09 16:42:00 438

原创 poj1455——Crazy tea party

<br />学校百年校庆... 好几天没A题了的说。<br />此题模拟下,算出每对需要移动的最小step即可。<br />#include<iostream>#include<cstdio>#include<string>using namespace std;void solve(int n,int t){ int i,len=n/2,sum=0; int step,st; for(i=1;i<=len;i++) { int m=n+1-i;//对应位置

2011-05-09 14:40:00 472

原创 poj1423——Big Number//Stirling公式

<br />题意:求N!的位数。<br />思路:1,Stirling公式  <br />         2,一个数X的位数是由log10(X)取整后加1得到。<br />#include<iostream>#include<cmath>using namespace std;#define pi 3.1415926535897932#define e 2.7182818284590452354#define e1 exp(1.0)int main(){ int test;

2011-05-05 23:45:00 461

原创 java小程序——简单计算器

<br />import java.applet.Applet;import java.awt.Button;import java.awt.Label;import java.awt.TextField;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.sound.sampled.AudioInputStream;import javax.swing.JButt

2011-05-05 20:52:00 2076

原创 poj1401——Factorial

<br />题意:求N!后面有多少零。<br />#include<iostream>#include<cstdio>using namespace std;int main(){ int i,t; int n,sum=0; cin>>t; while(t--) { scanf("%d",&n); for(sum=0,i=5;i<=n;i*=5) sum+=n/i; cout<<sum<<endl; } return 0;}

2011-05-04 17:34:00 458

原创 poj1388——Ugly Numbers

<br />import java.util.Scanner;public class c { /** * @param args */ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int []ugly=new int [1505]; int n,i,d2=1,d5=1,d3=1; ugly[1]=1; for(i=2;i<=1500;i++)

2011-05-04 13:31:00 518

原创 poj1470——Closest Common Ancestors//LCA

<br />果然A得辛苦,我想是用错模板了。囧,好累。http://www.cppblog.com/abilitytao/archive/2009/09/21/96886.html<br />#include<iostream>#include<string>#include<cstdio>#include<vector>using namespace std;const int maxn=906;vector<int >p[maxn];class node{public

2011-05-03 14:56:00 506

原创 poj1160——Post Office//dp

<br />动态规划还是最无语的一块~  参见:http://zebozhuang.blog.163.com/blog/static/1714798042010107104459174/<br />#include<iostream>#include<cstdio>#include<string>#include<math.h>using namespace std;#define maxn 305#define maxcost 9999999int w[maxn][maxn],

2011-05-02 20:36:00 474

原创 poj1102——LC-Display

模拟题。参考运用七段数码显示。参考:http://hi.baidu.com/%8E%E1%D0%B3/blog/item/0846471b6ccf8371dab4bd9a.html#include#include#includeusing namespace std;char n1[11]={"- -- -----"}; //笔画1被数字0,2,3,5,6,7,8,9覆盖char n2[11]={"| ||| ||"};

2011-05-02 17:07:00 398

原创 poj3177——Redundant Paths//最小割边

<br />跟3352一模一样,不过,需加判重。<br />#include<iostream>#include<cstdio>#include<cstring>using namespace std;int n,r;#define maxn 5005bool map[maxn][maxn];class node{public: int to,next;};node g[maxn*5];int head[maxn],cnt;int dfn[maxn],

2011-05-01 23:56:00 446

原创 poj3352——Road Construction//最小割边

题意:最少添加多少条边,可以让图成为双向连通图。对trajan算法还没有了解深入,参考博客:http://www.cppblog.com/Icyflame/archive/2009/07/04/89227.html                                                          http://hi.baidu.com/buaa_babt/blog/item/4d9a16c934384e2cf9dc61da.html                      

2011-05-01 23:08:00 476

创建学生信息管理系统

创建一个存储和显示学生信息的单文档应用程序。 功能如下:在编辑框中输入学生信息,单击“输入”按钮时,程序检测编号与以后学生信息是否重复,如果重复则跳出消息框提示“学号重复,请修改学生学号”,如果编号和姓名栏中是空的,系统提示“学生信息不全,请补全信息”,如果无上述情况,系统自动把输入内容存储到文档类中的一个学生信息类对象的数组中; 主菜单“编辑”中包含了“清空”子菜单,单击该子菜单或者点击工具栏上的红色“C”按钮时,删除所有学生的信息,并且清空界面上的“编号”和“姓名”编辑栏。

2010-12-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除