Advertisement
Emiliatan

e156 - 4

Apr 16th, 2019
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. /* e156 - 4        */
  2. /* AC (2ms, 112KB) */
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int n, ans = 0;
  8.  
  9. bool Sum_Solution()
  10. {
  11.     return (ans += n--) && n && Sum_Solution();
  12. }
  13.  
  14. int main()
  15. {
  16.     scanf("%d", &n);
  17.     Sum_Solution();
  18.     printf("%d", ans);
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement