【SGU】105. Div 3 水题
来源:互联网 发布:掌控网络 编辑:程序博客网 时间:2024/05/02 04:38
传送门:【SGU】105. Div 3
题目分析:第n个数的数字之和为n*(n + 1)/2。
代码如下:
#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std ;#pragma comment(linker, "/STACK:16777216")#define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i )#define rev( i , a , b ) for ( int i = ( a ) ; i >= ( b ) ; -- i )#define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i )#define clr( a , x ) memset ( a , x , sizeof a )#define cpy( a , x ) memcpy ( a , x , sizeof a )int n ;int main () {while ( ~scanf ( "%d" , &n ) ) printf ( "%d\n" , n / 3 * 2 + ( ( n + 1 ) % 3 == 0 ) ) ;return 0 ;}
0 0
- 【SGU】105. Div 3 水题
- [SGU]105. Div 3
- SGU 105. Div 3
- 【SGU】 105. Div 3
- SGU 105 Div 3
- sgu 105 Div 3
- sgu 105 Div 3
- SGU 105 Div 3
- [SGU 105] Div 3 [数学]
- SGU 105 Div 3 找规律
- SGU - 105 - Div 3 (简单数学题!)
- SGU 105 Div 3(数论)
- 2016 Personal Training #3 Div.2 SGU 409
- SGU 271 水题。。。。
- SGU 102 prime水题
- sgu 113(水题 暴力)
- SGU
- SGU
- Android Bitmap保存到SQLite
- 答读者问(24):一个大二学生有关数据结构学习的疑问及答复
- 字符串循环右移n个字符
- 高精度模板之高精乘高精
- JavaScript正则表达式语法及使用范例大全
- 【SGU】105. Div 3 水题
- cin.get( )与cin.getline( )的区别
- 双向链表的有关操作(创建,遍历,插入,删除)
- Risk - UVa 567 Floyd
- Linux开启ssh服务,开启远程登入前提
- win8.1(x64)下搭建memcached
- hdu-1003
- 轻松解决宝宝所有吃饭难题,还给宝宝一个健壮的身体和聪明的脑袋
- Cocos2d-JS 快速入门_01 环境搭建(Mac && Windows集合版)