Advertisement
HaciyevAlik

Sum Divisibility

Sep 2nd, 2022
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | Source Code | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. using ll = long long;
  5. using ld = long double;
  6. const int INF = 1e9;
  7.  
  8. //Acımasızca geçip giden zamandan
  9. //Geriye kalan sadece yalnızlıklarımız
  10.  
  11. int main(){
  12.     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  13.     int k; cin>>k;
  14.     int n = 1;
  15.     ll sum = 0;
  16.     while(true){
  17.         sum += n;
  18.         if(sum % k == 0){
  19.             cout << n << "\n";
  20.             break;
  21.         }
  22.         n++;
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement