fork download
  1. #include <iostream>
  2. using namespace std;
  3. typedef long long int64;
  4.  
  5. int64 COIN=100000000;
  6. int wrap = 0;
  7.  
  8. int64 GetBlockValue(int nHeight, int64 nFees)
  9. {
  10. int64 nSubsidy = 1 * COIN;
  11.  
  12. // Subsidy is cut in half every 70000 blocks, which will occur approximately
  13. nSubsidy >>= (nHeight / 70000); // Astrocoin: 70k blocks
  14. return nSubsidy + nFees;
  15. }
  16.  
  17. int main()
  18. {
  19. // your code goes here
  20. int64 totalcoin=0;
  21.  
  22. for (int block = 1; block < 5000000; block++)
  23. {
  24. int64 reward = GetBlockValue(block, 0);
  25. totalcoin += reward;
  26.  
  27. if (totalcoin >= (140000 * COIN) && wrap == 0){
  28. cout << "block:" << block << " reward " << reward << " totalcoin: " << totalcoin << "\r\n";
  29. wrap = 1;
  30. }
  31. if (totalcoin >= (210000 * COIN) && wrap == 1 ){
  32. cout << "block:" << block << " reward " << reward << " totalcoin: " << totalcoin << "\r\n";
  33. wrap = 2;
  34. }
  35.  
  36. }
  37.  
  38. }
  39.  
  40.  
Success #stdin #stdout 0.05s 3340KB
stdin
Standard input is empty
stdout
block:4480001 reward 100000000 totalcoin: 14000099160000
block:4550002 reward 50000000 totalcoin: 21000049160000