我希望你是我独家记忆

一段永远封存的记忆,随风而去
posts - 263, comments - 31, trackbacks - 0, articles - 3
   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理

URAL1068

Posted on 2008-11-05 15:59 Hero 阅读(92) 评论(0)  编辑 收藏 引用 所属分类: 代码如诗--ACM
 1 // 1068 C++ Accepted 0.015 121 KB URAL
 2 
 3 #include <stdio.h>
 4 #include <stdlib.h>
 5 #include <string.h>
 6 
 7 typedef __int64 llong ;
 8 
 9 int inn ;
10 llong out ;
11 
12 int main()
13 {
14     while( scanf( "%d"&inn ) !=EOF )
15     {
16         int temp = abs( inn ) ;
17         out = temp*(1+temp)/2 ;
18 
19         if0 == inn )
20         {
21             printf( "1\n" ) ;
22         }
23         else if( inn > 0 )
24         {
25             //out += 1 ;            
26             printf( "%I64d\n"out ) ;
27         }
28         else
29         {
30             out -= 1 ;
31             out = out * -1 ;
32             printf( "%I64d\n"out ) ;
33         }
34     }
35 
36     return 0 ;
37 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理