摘要: problem 1If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.Answer:233168对于1000一下的正整数中,3的倍数+5的倍数-gcd(3,5)的倍数简单的容斥原理:#include<stdio.h>int cal(int a, int m) { if ( 阅读全文
posted @ 2011-12-06 22:54 qingyezhu 阅读(215) 评论(0) 推荐(0)