Tổng Dãy Số

PDF

Submit solution

Points: 10.00
Time limit: 1.0s
Memory limit: 64M
Input: stdin
Output: stdout

Authors:
Problem types
Allowed languages
C, C++, Java, Pascal, Python, Scratch, TEXT

Gọi ~S=1+2+3+…+k~.

Yêu cầu

Nhập vào số nguyên ~n~, tìm số ~k~ sao cho ~S~ lớn nhất mà không vượt quá ~n~.

Dữ liệu

Một dòng duy nhất, gồm số nguyên ~n~ ~(0< n\le 10^3)~.

Kết quả

Ghi ra số ~k~ và tổng ~S~ tìm được, hai số cách nhau một khoảng trắng.

Input

11

Output

4 10

Comments

Please read the guidelines before commenting.


There are no comments at the moment.