^ :n^1 表示奇数减1,偶数加1; #include <stdio.h>int main( ){ int n; while(scanf("%d",&n)!=EOF) {int m;m=n^1;printf("n = %d flag = %d\n",n,m); } return 0;}&:x&1可判断x是奇数还是偶数(x&1=1 x 是奇数 x&1=0 x是偶数 Read More
posted @ 2012-08-04 22:52 jiai Views(72) Comments(0) Diggs(0) Edit
JapanTime Limit:1000MSMemory Limit:65536KTotal Submissions:14697Accepted:3945DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000). K Read More
posted @ 2012-08-04 09:50 jiai Views(121) Comments(0) Diggs(0) Edit
跟标准列相反序数的总和比如说标准列是1 2 3 4 5那么 5 4 3 2 1 的逆序数算法:看第二个,4之前有一个5,在标准列中5在4的后面,所以记1个类似的,第三个 3 之前有 4 5 都是在标准列中3的后面,所以记2个同样的,2 之前有3个,1之前有4个将这些数加起来就是逆序数=1+2+3+4=10 Read More
posted @ 2012-08-04 08:47 jiai Views(2302) Comments(0) Diggs(0) Edit