FSF’s game


Problem DescriptionnFSF has programmed a game.nIn this game, players need to divide a rectangle into several same squares.nThe length and width of rectangles are integer, and of course the side length of squares are integer.nnAfter division, players can get some coins.nIf players successfully divide a AxB rectangle(length: A, width: B) into KxK squares(side length: K), they can get A*B/ gcd(A/K,B/K) gold coins.nIn a level, you can’t get coins twice with same method. n(For example, You can get 6 coins from 2x2(A=2,B=2) rectangle. When K=1, A*B/gcd(A/K,B/K)=2; When K=2, A*B/gcd(A/K,B/K)=4; 2+4=6; )nnThere are N*(N+1)/2 levels in this game, and every level is an unique rectangle. (1x1 , 2x1, 2x2, 3x1, ..., Nx(N-1), NxN)nnFSF has played this game for a long time, and he finally gets all the coins in the game.nUnfortunately ,he uses an UNSIGNED 32-BIT INTEGER variable to count the number of coins.nThis variable may overflow.nWe want to know what the variable will be.n(In other words, the number of coins mod 2^32)n nnInputnThere are multiply test cases.nnThe first line contains an integer T(T<=500000), the number of test casesnnEach of the next T lines contain an integer N(N<=500000).n nnOutputnOutput a single line for each test case.nnFor each test case, you should output "Case #C: ". first, where C indicates the case number and counts from 1. nnThen output the answer, the value of that UNSIGNED 32-BIT INTEGER variable.n nnSample Inputn3n1n3n100n nnSample OutputnCase #1: 1nCase #2: 30nCase #3: 15662489


  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他