day22a.cpp (531B)
1 #include <algorithm> 2 #include <cstdint> 3 #include <iostream> 4 #include <map> 5 #include <queue> 6 #include <ranges> 7 #include <set> 8 #include <sstream> 9 #include <string> 10 #include <string_view> 11 #include <vector> 12 using namespace std; 13 14 int64_t next(int64_t n) { 15 constexpr int64_t M = 16777216; 16 n = ((n*64) ^ n) % M; 17 n = ((n/32) ^ n) % M; 18 n = ((n*2048) ^ n) % M; 19 return n; 20 } 21 22 int main() { 23 int64_t s; 24 int64_t tot = 0; 25 while (cin >> s) { 26 for (int i = 0; i < 2000; i++) 27 s = next(s); 28 tot += s; 29 } 30 cout << tot << endl; 31 return 0; 32 }