A题
快读快写函数 + sort() ;
略
B题 Little Gyro and Sets
题意:给出n和m,将1~m中为n的倍数的放到a中,否则放到b中,求sum(b)-sum(a).
题解:用等差求和求出1~m 记为sum , n的倍数也可以看做是一个等差数列求和并记为t,然后用sum(b)= sum-t , sum(a) = t , 所以结果为sum-2*t ;
#include <cstdio>
#include <algorithm>
using namespace std ;
typedef long long ll ;
inline int read(){
//快读函数
int x = 0 , f = 1 ;
char ch = getchar();
while(ch < '0' || ch > '9') {
if (ch == '-')
f = -1 ;
ch = getchar() ;
}
while(ch >= '0' && ch <= '9'){
x = (x << 1) + (x << 3) + (ch^48) ;
ch = getchar() ;
}
r