sgu105-数学
2014-04-23 15:14
316 查看
105. Div 3time limit per test: 0.25 sec. memory limit per test: 4096 KBThere is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3.InputInput contains N (1<=N<=231 - 1).OutputWrite answer to the output.Sample Input4Sample Output 2 我是根据发现规律解出来的
#include <iostream>using namespace std;int main(){ int N; cin >> N; int ans = 0; if (N % 3 == 2) ans++; ans += 2 * (N / 3); cout << ans; return 0;}[/code] |
相关文章推荐
- SGU 105 数学找规律
- SGU 105 数学找规律
- SGU - 105 - Div 3 (简单数学题!)
- SGU 105 数学题or找规律
- [SGU 105] Div 3 [数学]
- sgu 126 Boxes 数学推导(打表找规律??...)
- sgu 154 二分 + 数学方法 sgu 111 二分 + 高精度 (Java)
- SGU 105 Div 3
- SGU 107 数学题
- sgu 108 self number(数学问题滚动数组)
- Div 3 - SGU 105(找规律)
- 【sgu】105 解题报告
- SGU 105 Div 3
- Sgu105
- SGU 107 数学题
- SGU 105 Div 3 翻译 题解
- 数学 + 带权中位数 - SGU 114 Telecasting station
- SGU 105 Div 3
- 数学/找规律/sgu105 Div 3
- SGU105 水题 An easy problem