ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 백준 2292번 C++ 풀이
    카테고리 없음 2018. 11. 3. 23:35

    for 문에 조건을 여러개 붙였습니다..



    #include <iostream>
    #include <algorithm>
    #include <queue>
    using namespace std;

    int main(){
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    long long n;

    cin >> n;
    int number = 0;
    for (auto i =1, j=0; i< n; j+= 6, i +=j ){
    number++;

    }
    cout << number+1;
    return 0;

    }


Designed by Tistory.