1.迭代服务器模型 1.1 迭代服务器是处理多个请求时一种最简单直接的思路,即使用while循环,它不具有并发能力,即必须一个一个的处理客户的请求。 1.2 程序示例。#include "def.h"int listenfd_init(); //返回一个处于监听状态的套接字描述符void do...
分类:
编程语言 时间:
2014-07-31 02:18:25
阅读次数:
365
如何把textview的一些文字加上背景色:
Spannable str = new SpannableString("#fdsfdfsdfdsfd#");
Matcher matcher = getEmailPattern().matcher((CharSequence) str);
while (matcher.find()) {
int start = matcher.sta...
分类:
移动开发 时间:
2014-07-31 00:02:05
阅读次数:
427
将整数一个字符一个字符地读入,再转成整数,比直接作为整数读入快。在读入大规模的整数数据时比较有效。代码如下:inline void read_int(int &num){ char c; while (c = getchar(), c '9'); num = c - '0'; whil...
分类:
其他好文 时间:
2014-07-30 23:20:45
阅读次数:
507
水题:
代码如下:
#include
#include
int main()
{
int n,m,i,j,count;
double c,sc;//设为double型才给通过
double s,s1,s2;
char name[33];
scanf("%d",&n);
while(n--)
{
s1=s2=0;
count=0;
scanf(...
分类:
其他好文 时间:
2014-07-30 20:58:04
阅读次数:
148
#includeusing namespace std;void count(){ int value; int cnt; int curvalue; if(cin>>curvalue) { cnt=1; while(cin>>value) ...
分类:
其他好文 时间:
2014-07-30 20:34:44
阅读次数:
137
在使用pod install命令后,一直处于analyzing dependencies的状态,之后出现error:[!] An error occurred while performing `git pull` on repo `master`. [!] /usr/bin/git pull --...
分类:
其他好文 时间:
2014-07-30 20:24:34
阅读次数:
237
在大矩形中找一个小矩形
使小矩形包含的*最多
暴力或者DP 水题
暴力:
#include "stdio.h"
#include "string.h"
int main()
{
int n,m,w,i,s,t,j,k,l,ans,sum,x,y;
int map[101][101];
while (scanf("%d",&w)!=EOF)
...
分类:
其他好文 时间:
2014-07-30 17:44:24
阅读次数:
201
Master-Mind Hints
MasterMind is a game for two players. One of them, Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. ...
分类:
其他好文 时间:
2014-07-30 14:44:53
阅读次数:
242
#include #include int f[1001][1001];int c[1001];int w[1001];int N,V;int main(){ int t; int i,j; scanf("%d",&t); while(t--) { mem...
分类:
其他好文 时间:
2014-07-30 14:43:03
阅读次数:
209
1)忘记在?if?,?elif?,?else?,?for?,?while?,?class?,def?声明末尾添加 :(导致 “SyntaxError :invalid syntax”) 该错误将发生在类似如下代码中: 1 2 if?spam==?42 ????print(‘Hello!‘)...
分类:
编程语言 时间:
2014-07-30 12:38:24
阅读次数:
334