SGU105—— Div 3
来源:互联网 发布:linux redis 批量删除 编辑:程序博客网 时间:2024/05/16 10:58
105. Div 3
time limit per test: 0.5 sec.
memory limit per test: 4096 KB
There 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.
Input
Input contains N (1<=N<=231 - 1).
Output
Write answer to the output.
Sample Input
4
Sample Output
3
找规律:
易得: 要求的数=n/3*2;
#include<iostream>#include<string.h>#include<stdio.h>#include<ctype.h>#include<algorithm>#include<stack>#include<queue>#include<set>#include<math.h>#include<vector>#include<map>#include<deque>#include<list>using namespace std;int main(){ int n,sum; while(scanf("%d",&n)!=EOF) { sum=(double)n/3*2; printf("%d\n",sum); } return 0;}
- SGU105—— Div 3
- SGU105 Div 3
- sgu105:Div 3
- SGU105 Div 3
- sgu105: Div 3
- SGU105 Div 3
- SGU105
- Sgu105
- sgu105
- sgu105-数学
- sgu105 算是数学么。。。
- SGU105【找规律】
- SGU105 水题 An easy problem
- SGU水题大集合 SGU104 SGU105 SGU107
- div——02
- CSS—DIV
- div+css基础——9.div其它常用属性
- Css+Div布局学习(一)—Div布局基础
- java对byte数组解压缩(zip,gzip,bzip2,jzlib)
- ubuntu安装subversion
- 使用 Storyboard Segue 实作 UIViewController 的切换
- [MySQL] 索引与性能(4)- 排序
- linux系统服务的基础知识
- SGU105—— Div 3
- JS 实现文件夹目录选择
- 为面试做准备之冒泡排序
- Hadoop-数据库发送和接收相关实现-DataXceiver解析<转>
- android.widget.textview cannot be casted to android.widget.button
- Toast详解
- 深入解析 SAP ABAP 基本数据类型(ABAP elementary types)
- 4.5 Using Different Types of Accessories in a Table View Cell
- 基于Web的嵌入式设备管理