LeeBlog

导航

2011年4月5日 #

lucky number 被恶心到的一题目

摘要: Problem F:Lucky numbersTime Limit:1000MS Memory Limit:65536KTotal Submit:108 Accepted:14 Description Digits 6 and 8 are lucky, while all others are unlucky. An integer is lucky if it contains only lucky digits in decimal notation. We would like to know the K-th lucky positive integer. Input The firs 阅读全文

posted @ 2011-04-05 22:42 LeeBlog 阅读(944) 评论(0) 推荐(0) 编辑

输入密码

摘要: int inputps(char p1[]){ int i=0; char ch; while((ch=getch())&&ch!=13) { if(ch==27) return 0; if( ch==8 && i !=0 ) { printf( "\b \b" ); p1[--i] = 0; } else if(ch==8&&i==0) co... 阅读全文

posted @ 2011-04-05 17:39 LeeBlog 阅读(439) 评论(0) 推荐(0) 编辑

HDU 2689 sort it

摘要: 此题就是求冒泡的次数,用冒泡做时间比较长,用树状数组做比较快#include<stdio.h>int num[1024],n;int main( ){ while( scanf( "%d",&n ) != EOF ) { for( int i = 0; i < n; ++i ) scanf( "%d",&num[i] ); int count = 0; for( int i = 0,f = 0; i < n - 1; ++i ) { f = 0; for( int j = 0; j + 1< n - i; + 阅读全文

posted @ 2011-04-05 14:23 LeeBlog 阅读(196) 评论(0) 推荐(0) 编辑

hdu 1166 敌兵布阵 树状数组 模板题

摘要: 这题是树状数组入门的一模板题,非常基础,被小白成为"赤裸裸"的入门题,哈哈,一个plus,一个sum全部搞定#include<stdio.h>#include<string.h>#define lowbit( x ) ( x )&( -x )int tree[50024],num,n;void plus( int num,int x ){ while( x <= n ) { tree[x] += num; x += lowbit( x ); } }int sum( int x ){ int sum = 0; while( x ) { s 阅读全文

posted @ 2011-04-05 13:48 LeeBlog 阅读(411) 评论(0) 推荐(0) 编辑