fork(10) download
  1. /*
  2. */
  3.  
  4. //#pragma comment(linker, "/STACK:16777216")
  5. #include <fstream>
  6. #include <iostream>
  7. #include <string>
  8. #include <complex>
  9. #include <math.h>
  10. #include <set>
  11. #include <vector>
  12. #include <map>
  13. #include <queue>
  14. #include <stdio.h>
  15. #include <stack>
  16. #include <algorithm>
  17. #include <list>
  18. #include <ctime>
  19. #include <memory.h>
  20. #include <ctime>
  21.  
  22. #define y0 sdkfaslhagaklsldk
  23. #define y1 aasdfasdfasdf
  24. #define yn askfhwqriuperikldjk
  25. #define j1 assdgsdgasghsf
  26. #define tm sdfjahlfasfh
  27. #define lr asgasgash
  28.  
  29. #define eps 1e-9
  30. //#define M_PI 3.141592653589793
  31. #define bs 1000000007
  32. #define bsize 256
  33. #define MAXN 1000
  34.  
  35. using namespace std;
  36.  
  37. int n;
  38. int get(int x)
  39. {
  40. int s=0;
  41. while (x)
  42. {
  43. s+=x%2;
  44. x/=2;
  45. }
  46. return s;
  47. }
  48.  
  49. void show(int x)
  50. {
  51. vector<int> v;
  52. while (x)
  53. {
  54. v.push_back(x%2);
  55. x/=2;
  56. }
  57. for (int i=v.size()-1;i+1;--i)
  58. cout<<v[i];
  59. cout<<endl;
  60. }
  61. int main(){
  62. //freopen("newlines.in","r",stdin);
  63. //freopen("newlines.out","w",stdout);
  64. //freopen("F:/in.txt","r",stdin);
  65. //freopen("F:/output.txt","w",stdout);
  66. ios_base::sync_with_stdio(0);
  67. //cin.tie(0);
  68.  
  69. int res=0;
  70.  
  71. //cin>>n;
  72. n=45;
  73.  
  74. show(n);
  75. for (int i=1;i<n;i++)
  76. res+=get(i);
  77. cout<<res<<endl;
  78.  
  79. //cin.get();cin.get();
  80. return 0;}
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
101101
115