计算最长连续相同字符的个数
测试数据
输入:
aaaassdfg
adasafag
ssddffffgt
输出:
4
1
4
#include
#include
int main()
{
int i,n,t;
int b[105];
char a[105];
scanf("%d",&t);
while(t--)
{
...
分类:
其他好文 时间:
2014-06-11 06:40:08
阅读次数:
207
非常巧妙的题目,巧用cmp,注意cmp的重载
#include
#include
using namespace std;
string a[55];
bool cmp(string a, string b){
return a+b > b+a;
}
int main(int argc, char const *argv[])
{
int n;
while(cin >...
分类:
其他好文 时间:
2014-06-11 06:10:28
阅读次数:
293
while loops
定义与实例
i = 0
numbers = []
while i < 6:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % ...
分类:
编程语言 时间:
2014-06-11 00:59:17
阅读次数:
410
在前面我们在解决线程同步问题的时候使用了synchronized关键字,今天我们来看看Java 5.0以后提供的线程锁Lock.Lock接口的实现类提供了比使用synchronized关键字更加灵活和广泛的锁定对象操作,而且是以面向对象的方式进行对象加锁。 @Override
public void run() {
while(true){
Lock lock = new Re...
分类:
移动开发 时间:
2014-06-11 00:57:51
阅读次数:
329
Swift语言使用var定义变量,但和别的语言不同,Swift里不会自动给变量赋初始值,也就是说变量不会有默认值,所以要求使用变量之前必须要对其初始化。如果在使用变量之前不进行初始化就会报错:
1
2
3
4
5
var
stringValue : String
//error:
variable 'st...
分类:
其他好文 时间:
2014-06-11 00:44:59
阅读次数:
374
if ((!WriteFile(
m_hDevEx,
pBuf,
size,
&WriteBytes,
&Overlapped)) &&
(GetLastError() != ERROR_IO_PENDING))
{
OutputDebugString("Writ...
分类:
其他好文 时间:
2014-06-10 13:47:45
阅读次数:
149
问题: cannot find -lnlcollect2: error: ld returned 1 exit statusmake: *** [wpa_supplicant] 错误 1解决方法:[fulinux@ubuntu wpa_supplicant]$ sudo apt-get install libnl-dev libssl-dev...
分类:
其他好文 时间:
2014-06-10 13:35:36
阅读次数:
262
bool Topo()
{
int sum = 0;
while(1)
{
queue Q;
for(int i = 1; i <= n; i++)
if(!in[i])
Q.push(i);
sum += Q.size();
if(sum == n)
return true;
if(!Q.size())
return false;
whi...
分类:
其他好文 时间:
2014-06-10 13:29:29
阅读次数:
236
1、错误描述
六月 09, 2014 11:11:09 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error
严重: Template processing error: "Expression a is undefined on line 27, column 23 in tag.ftl."
Expression a is undefi...
分类:
其他好文 时间:
2014-06-10 07:33:34
阅读次数:
293
1 #include 2 // 主函数main 3 int main() 4 { 5 int
a,b; 6 // 在while循环中以EOF作为文件结束标志 7 // ASCII代码值的范围是0~255,不可能出现-1,因此可以用EOF作为文件结束标志
8 whil...
分类:
其他好文 时间:
2014-06-10 00:42:55
阅读次数:
284