码迷,mamicode.com
首页 >  
搜索关键字:scala for if match while    ( 37974个结果
杭电 2000
#include using namespace std;#define MAXN 4int main(){ //char arr[MAXN] = {0}; char arr[MAXN]; memset(arr,0,MAXN); while (cin >> arr) {...
分类:其他好文   时间:2014-05-14 02:32:38    阅读次数:327
杭电2001
#include #include #include using namespace std;int main(){ double x1,y1,x2,y2; double result; while (cin>>x1>>y1>>x2>>y2) { result ...
分类:其他好文   时间:2014-05-14 02:02:49    阅读次数:242
Operation System - Peterson's Solution算法 解决多线程冲突
Person's solution 是用来一种基于软件的解决关键区域问题的算法(critical-section). 它并非完美的,有可能不正确地工作。而且是限制解决两个进程同步的问题。 但是它很简单,很原始,学习起来也是很轻松的。 代码如下: do { flag[i] = true; turn = j; while (flag[j] && turn == j...
分类:编程语言   时间:2014-05-13 08:01:01    阅读次数:407
Include设置layout_*无效解决方法
在include标签中不能省略 layout_width或者layout_height否则设置layout_weight就会无效。如下设置即可             android:id="@+id/linearLayout1"         android:layout_width="match_parent"         android:layout_height="w...
分类:其他好文   时间:2014-05-13 07:12:47    阅读次数:389
Spark on YARN--WordCount、TopK
1、首先利用http://dongxicheng.org/framework-on-yarn/spark-eclipse-ide/搭建好的Eclipse(Scala)开发平台编写scala文件,内容如下:import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ object HdfsWordCount {...
分类:其他好文   时间:2014-05-13 05:35:12    阅读次数:379
用shell脚本监控linux系统 自动发送邮件
此脚本可以做一个定时的检测,超出设定的值,即往邮箱发送警告脚本用到bc,sendmail,163邮箱,yuminstallbc#!/bin/bash #SystemMonitoringScript while[1] do #本机需开启postfix或sendmail服务。 #报警邮件地址设置 MAILFROM=root@localhost MAILTO=your_mail@163.com #设置..
分类:系统相关   时间:2014-05-13 05:05:29    阅读次数:649
php循环删除目录及目录下的文件
分享两个使用函数:php循环删除目录及目录下的文件和仅删除指定目录下的文件,不删除目录文件夹!代码一:php循环删除目录及目录下的文件<?php//循环删除目录和文件函数functiondelDirAndFile($dirName){if($handle=opendir("$dirName")){while(false!==($item=readdir($han..
分类:Web程序   时间:2014-05-13 01:47:25    阅读次数:410
HDU 4028 The time of a day STL 模拟题
暴力出奇迹。。 #include #include #include #include #include #include #include #include using namespace std; #define ll __int64 #define N 42 ll n,m,ans; ll Gcd(ll x,ll y){ if(x>y)swap(x,y); while(x){ y%=...
分类:其他好文   时间:2014-05-12 23:11:06    阅读次数:445
C语言文件操作(一)
实例1:读写字符文件,每次读取一个字符。#include<stdio.h>#include<stdlib.h>intmain(){FILE*fpin;FILE*fpout;charc;fpout=fopen("c:\\dest.txt","wt");if((fpin=fopen("c:\\test.txt","rt"))!=NULL){c=fgetc(fpin);while(c!=EOF){fputc(c,fpout);c=fgetc(fpin);..
分类:编程语言   时间:2014-05-12 03:57:13    阅读次数:238
C语言文件操作(二)
实例2:读取字符文件,每次读入一个缓存里面。#include<stdio.h>#include<stdlib.h>#defineMAXLEN1024intmain(){FILE*fin;FILE*fout=fopen("c:\\dest.txt","wt");charbuf[MAXLEN];if((fin=fopen("c:\\test.txt","rt"))!=NULL){char*c=fgets(buf,MAXLEN,fin);while(..
分类:编程语言   时间:2014-05-12 02:57:48    阅读次数:251
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!