题解 | #小乐乐求和#

小乐乐求和

http://www.nowcoder.com/practice/ce0b2eacd3d04647831358c2876e44ff

import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        long sum = 0L;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        System.out.print(sum);
    }
}

全部评论

相关推荐

酷酷我灵儿帅:这去不去和线不线下面说实话没啥关系
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务