应该说这是比较高效的解题方法了吧。素数个数计数:classSolution{
public:
intcountPrimes(intn){
bool*a=newbool[n];
for(inti=2;i*i<n;i++){
if(!a[i]){
for(intj=i;i*j<n;j++){
a[i*j]=true;
}
}
}
intc=0;
for(inti=2;i<n;i++){
if(a[i]==false)++c;
}
returnc;..
分类:
其他 时间:
2015-05-28 18:25:05
收藏:
0 评论:
0 赞:
0 阅读:
179
mysql主从复制的过称其实是:将一台服务器的数据复制到其他服务器上并重新执行一遍的。复制过程中一台服务器当作主服务器(Master),一台或多台服务器当作从服务器(SLave).主服务器将更新写入到二进制日志文件,并维护一个索引以跟踪日志循环。这些日志可以记录发送给从服务器的..
分类:
数据库技术 时间:
2015-05-28 18:24:55
收藏:
0 评论:
0 赞:
0 阅读:
283
同网段用wget下载文件1.先在有文件需要传送到另一个服务器上的主服务器上创建一个专供下载的用户名。打开计算机右键,找到本地用户和组,在用户下新建一个用户。2.在internet信息管理下创建一个FTP站点。1)创建站点选择需要下载拷贝的那个文件夹2)允许匿名访问,要不然会一直..
分类:
其他 时间:
2015-05-28 18:24:44
收藏:
0 评论:
0 赞:
0 阅读:
396
<htmllang="zh-cn"><head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/><metahttp-equiv="X-UA-Compatible"content="IE=edge,chrome=1"><metahttp-equiv="Cache-Control"content="no-siteapp"/><styletype="text/css"&..
分类:
编程语言 时间:
2015-05-28 18:24:15
收藏:
0 评论:
0 赞:
0 阅读:
316
android实现手机震动1.在AndroidManifest.xml中添加震动权限<?xmlversion="1.0"encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"package="uni.vibrator"android:versionCode="1"android:versionName="1.0"><uses-sdkand..
分类:
移动平台 时间:
2015-05-28 18:23:54
收藏:
0 评论:
0 赞:
0 阅读:
287
android实现手机震动1.在AndroidManifest.xml中添加震动权限<?xmlversion="1.0"encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"package="uni.vibrator"android:versionCode="1"android:versionName="1.0"><uses-sdkand..
分类:
移动平台 时间:
2015-05-28 18:23:44
收藏:
0 评论:
0 赞:
0 阅读:
302
让机房工程师安装CentOS6.5系统(最小化安装)后发现网卡名字都是em开头的
ifconfig
em1Linkencap:EthernetHWaddr84:2B:2B:0C:FF:07
inetaddr:2.2.2.2Bcast:2.2.2.255Mask:255.255.255.0
inet6addr:fe80::862b:2bff:fe0c:ff07/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500M..
分类:
其他 时间:
2015-05-28 18:23:35
收藏:
0 评论:
0 赞:
0 阅读:
287
1.android简单按钮监听----单个监听start=(Button)findViewById(R.id.btnStart);start.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//---dosomething}});2.View.OnClickListener方法publicclassMyActivityextendsActivity{/***Calledwhentheac..
分类:
移动平台 时间:
2015-05-28 18:23:24
收藏:
0 评论:
0 赞:
0 阅读:
466
环境需求:hostname:web1ip:192.168.1.241hostname:ha1ip:192.168.1.243hostname:ha2ip:192.168.1.242keepalivedvip:192.168.1.2451.nginx+upstream安装(ha1和ha2配置一样)[root@ha1opt]#yum-yinstallgccgcc-c++opensslopenssl-devel[root@ha1opt]#useraddnginx-s/sbi..
分类:
其他 时间:
2015-05-28 18:23:15
收藏:
0 评论:
0 赞:
0 阅读:
313
android自定义按钮1》定义按钮布局文件<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"androidrientation="horizontal"android:layout_gravity="center"android:layout_width="wrap_content"android:l..
分类:
移动平台 时间:
2015-05-28 18:23:04
收藏:
0 评论:
0 赞:
0 阅读:
223
android:weight属性能够根据手机高宽按设定比例显示控件如:宽度上按比例显示<LinearLayoutandroid:layout_marginTop="5dp"androidrientation="horizontal"android:layout_width="fill_parent"----------------让其满宽android:layout_height="wrap_content"><Buttona..
分类:
移动平台 时间:
2015-05-28 18:22:55
收藏:
0 评论:
0 赞:
0 阅读:
303
androidlineLayout显示通过java代码来显示隐藏这个布局和里面的控件可以用LinearLayoutjishuan=(LinearLayout)findViewById(R.id.jishuan);jishuan.setVisibility(View.VISIBLE);//显示jishuan.setVisibility(View.INVISIBLE);//不显示,但占空间jishuan.setVisibility(View.GO..
分类:
其他 时间:
2015-05-28 18:22:45
收藏:
0 评论:
0 赞:
0 阅读:
250
1、DOCTYPE严格模式与混杂http://www.cnblogs.com/lxin/archive/2013/02/18/2915344.html原文链接:Quirksmodeandstrictmode地址是:http://www.quirksmode.org/css/quirksmode.html问题的产生:当Netscape4(译注:网景公司早期的浏览器)和IE4(微软公司早期的浏览器)实现CS..
分类:
其他 时间:
2015-05-28 18:22:34
收藏:
0 评论:
0 赞:
0 阅读:
277
1、一对多关联,级联操作@OneToMany(mappedBy="paymentad",cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=PaymentAdHistory.class)publicList<PaymentAdHistory>getPaymentHis(){returnpaymentHis;}PaymentAdHistory类中@ManyToOne(cascade={CascadeType.M..
分类:
Web开发 时间:
2015-05-28 18:22:24
收藏:
0 评论:
0 赞:
0 阅读:
566
示例代码一:packagecom;
publicclassArrayDemo1{
publicstaticvoidmain(String[]args){
int[]arr=newint[]{12,34,54,23};
//int[]arr={12,34,54,23};
/*System.out.println(arr[0]);
System.out.println(arr[1]);
System.out.println(arr[2]);
System.out.println(arr[3]);*/
..
分类:
编程语言 时间:
2015-05-28 18:22:05
收藏:
0 评论:
0 赞:
0 阅读:
292
RedHat安装完成后默认是无法直接安装rpm包的,需要自己修改yum库配置文件。本文记录我配置本地yum库的过程。step1:在home目录下创建目录repo,挂载安装镜像文件mount/dev/cdrom/mnt/repostep2:复制镜像文件到磁盘cp-rf/mnt/repo/homestep3:备份原始yum库配置文件cp/etc/yum.rep..
分类:
其他 时间:
2015-05-28 18:21:35
收藏:
0 评论:
0 赞:
0 阅读:
281
gitclonexxx@xx版本后,edit某文件,commit之后,点push,提示报错。可能有以下原因:1、权限不够,远程仓库的文件夹(比如/home/git)下面的文件所属用户非git用户,而默认的文件权限通常是644,那么当你用非git用户push的时候,肯定是权限不够的。解决方法:进入远程仓库的上..
分类:
其他 时间:
2015-05-28 18:21:24
收藏:
0 评论:
0 赞:
0 阅读:
489
1、什么是Canvas?<canvas>标签用于在网页上绘制图像,<canvas>元素本身并没有绘制能力(它仅仅是图形的容器),必须使用脚本(通常是JavaScript)来完成实际的绘图任务。2、HTML5Canvas参考手册http://www.w3school.com.cn/html5/html5_ref_canvas.asphttp://www...
分类:
Web开发 时间:
2015-05-28 18:21:14
收藏:
0 评论:
0 赞:
0 阅读:
346
packageteat_03;publicclassHanshu{/**publicstaticintadd(inta,intb){intc=a+b;returnc;}publicstaticvoidmain(String[]agrs){inta=40;intb=20;intsum=a/b;System.out.println("除:"+sum);}*//**publicstaticintadd(inta,intb,intc){intd=(a+b)/2;returnd;}*/publicstaticvoi..
分类:
编程语言 时间:
2015-05-28 18:20:45
收藏:
0 评论:
0 赞:
0 阅读:
214
1.window.open(‘‘url‘‘)
2.用自定义函数
<script>
functionopenWin(tag,obj)
{
obj.target="_blank";
obj.href="Web/Substation/Substation.aspx?stationno="+tag;
obj.click();
}
</script>
<ahref="javascript:void(0)"onclick="openWin(3,this)">株洲&..
分类:
Web开发 时间:
2015-05-28 18:20:35
收藏:
0 评论:
0 赞:
0 阅读:
333