Submit solution
Points:
1.00 (partial)
Time limit:
1.0s
Memory limit:
256M
Input:
stdin
Output:
stdout
Problem type
Allowed languages
Python, Scratch
Ban tổ chức đưa ra cho các thí sinh một trò chơi: dùng ~N~ que diêm của ban tổ chức đã chuẩn bị để xếp thành lưới tam giác như hình trên thì có thể xếp được tam giác có nhiều nhất bao nhiêu tầng (chỉ tính tầng đã hoàn thiện).
Dữ liệu
- Gồm một dòng chứa một số tự nhiên ~N~ ~(N ≤ 10^{15})~ là số que diêm mà ban tổ chức đã chuẩn bị.
Kết quả
- Gồm một dòng chứa một số tự nhiên là kết quả của bài toán.
Chấm điểm
- Có 50% số test ứng với 50% số điểm có: ~N ≤ 10^6~;
- 50% số test còn lại ứng với 50% số điểm không có ràng buộc gì thêm.
Sample Input 1
10
Sample Output 1
2
Note 1
- Xếp được ~2~ tầng thì hết ~9~ que diêm, que diêm thứ ~10~ xếp sang tầng thứ ~3~ nhưng tầng đó chưa hoàn thiện nên không tính.
Sample Input 2
18
Sample Output 2
3
Note 2
- ~18~ que diêm xếp trọn vẹn được ~3~ tầng.
Comments
Code nè: from math import* n=int(input()) k=int(sqrt(n2/3))+1 while 3(1+k)*k/2>n: k-=1 print(k)
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
from math import* n=int(input()) k=int(sqrt(n2/3))+1 while 3(1+k)*k/2>n: k-=1 print(k)
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.