标签:style blog io color os sp div on log
1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cctype> 5 #include <cmath> 6 #include <ctime> 7 #include <string> 8 #include <map> 9 #include <stack> 10 #include <set> 11 #include <vector> 12 #include <algorithm> 13 #include <iostream> 14 using namespace std; 15 typedef long long ll; 16 #define PI acos( -1.0 ) 17 const double E = 1e-8; 18 int n, m; 19 20 int main() 21 { 22 int T; 23 scanf( "%d", &T ); 24 while( T-- ) 25 { 26 scanf( "%d%d", &n, &m ); 27 if( m > n ) 28 { 29 puts( "0" ); 30 continue; 31 } 32 int t = n % m; 33 if( t <= m / 2 ) 34 printf( "%d\n", n*n - t*t ); 35 else 36 printf( "%d\n", n*n - ( m-t )*( m-t ) ); 37 } 38 return 0; 39 }
标签:style blog io color os sp div on log
原文地址:http://www.cnblogs.com/ADAN1024225605/p/4085056.html