摘要: hdu 2522 A simple problem除法的本质,模拟除法的过程即可;中间用一个数组保存出现过的余数,若同一个余数出现俩次,则出现了循环节;考虑可能出现负数;#include<stdio.h>#include<string.h>int f[100000];int hash[100000];int main(){ int t,m,y,cnt,n,i; scanf("%d",&t); while(t--) { scanf("%d",&n); if(n<0) { printf("-" 阅读全文
posted @ 2011-09-24 00:42 枕边梦 阅读(254) 评论(0) 推荐(1) 编辑
摘要: hdu 1556 Color the ball中文的题目,题意就不说了用线段树做了,不过有不用线段树的方法,不过我解释不来贴代码吧#include<iostream>#define MAXN 100010using namespace std;int p[MAXN<<2];void insert(int k,int s,int t,int l,int r){ if(l<=s && t<=r) { p[k]++; return ; } int kl=k<<1,kr=kl+1,mid=(s+t)>>1; if(l<= 阅读全文
posted @ 2011-09-24 00:31 枕边梦 阅读(215) 评论(0) 推荐(0) 编辑