void solve() { ios; int t; cin >> t; while(t -- ) { int n; cin >> n; int sum = n * (n + 1) / 2; int temp = 1; while(1) { sum -= temp * 2; temp *= 2; if(temp > n) { break; } } cout << sum << "\n"; } }View Code
标签:Educational,temp,int,cin,Codeforces,while,Round From: https://www.cnblogs.com/codeforceshobby/p/17044124.html