题解

165 条题解

  • 2
    @ 2017-05-14 20:21:42

    \(f(i)=f(i-1)+i (0 \le i \le 34567890, f(0)=1 )\)

  • 1
    @ 2021-03-17 09:17:25
    #include <cmath>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <deque>
    using namespace std;
    
    namespace dts
    {
        typedef long long ll;
        
        ll n;
        
        void main()
        {
            scanf("%lld",&n);
            printf("%lld\n",n*(n+1)/2+1);
        }
    };
    
    int main()
    {
        dts::main();
    }
    
  • 1
    @ 2017-08-22 02:22:19
    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    int main()
    {
        int a,i;
        long long c=1;
        scanf("%d",&a);
        for(i=1;i<=a;i++)
        {
            c=c+i;
        }
        printf("%lld",c);
        return 0;
    }
    
  • 0
    @ 2017-02-16 13:55:33

    #include<bits/stdc++.h>
    using namespace std;

    int main()
    {
    int a,b;
    long long c=0;
    cin>>a;
    for(b=1;b<=a;b++){
    c=c+b;
    }
    cout<<c+1;
    return 0;
    }

  • 0
    @ 2016-05-19 16:59:28
  • 0
    @ 2016-03-26 20:47:36

    AC100纪念

  • 0
    @ 2014-12-13 15:10:25

    评测结果
    编译成功

    测试数据 #0: Accepted, time = 15 ms, mem = 812 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 812 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 816 KiB, score = 10
    测试数据 #3: Accepted, time = 0 ms, mem = 812 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 812 KiB, score = 10
    测试数据 #5: Accepted, time = 15 ms, mem = 812 KiB, score = 10
    测试数据 #6: Accepted, time = 15 ms, mem = 816 KiB, score = 10
    测试数据 #7: Accepted, time = 31 ms, mem = 820 KiB, score = 10
    测试数据 #8: Accepted, time = 62 ms, mem = 816 KiB, score = 10
    测试数据 #9: Accepted, time = 62 ms, mem = 816 KiB, score = 10
    Accepted, time = 200 ms, mem = 820 KiB, score = 100
    ###代码
    program cut;
    var
    i,n:longint;
    a:int64;
    begin
    readln(n);
    a:=1;
    for i:=1 to n do a:=a+i;
    writeln(a);
    end.

    其实主要就是范围问题……答案要用_int64_

  • 0
    @ 2014-10-05 21:35:15

    #include<iostream>
    using namespace std;
    __int64 n,f;
    int main()
    {
    cin>>n;
    f=n*(n+1)/2+1;
    cout<<f<<endl;
    return 0;
    }
    AC60纪念

  • 0
    @ 2014-03-16 17:33:02

    水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水水
    纪念vijios第三道不用数组的题

    var n,k:longint;s:int64;
    begin
    readln(n);k:=0;s:=1;
    while k<>n do begin inc(k);s:=s+k;end;
    writeln(s);
    end.

  • 0
    @ 2013-11-03 08:32:04

    var
    n,m:int64;
    begin
    readln(n);
    m:=1+(n*(n+1)) shr 1;
    writeln(m);
    end.
    经典的简单数学题。。。

  • 0
    @ 2013-09-23 21:21:08

    简单啊!!!

  • 0
    @ 2013-09-23 21:20:41

    评测结果
    编译成功

    foo.pas(5,8) Warning: Variable "i" does not seem to be initialized
    foo.pas(8,6) Warning: Variable "k" does not seem to be initialized

    测试数据 #0: Accepted, time = 0 ms, mem = 824 KiB, score = 10

    测试数据 #1: Accepted, time = 0 ms, mem = 820 KiB, score = 10

    测试数据 #2: Accepted, time = 0 ms, mem = 820 KiB, score = 10

    测试数据 #3: Accepted, time = 0 ms, mem = 824 KiB, score = 10

    测试数据 #4: Accepted, time = 0 ms, mem = 820 KiB, score = 10

    测试数据 #5: Accepted, time = 46 ms, mem = 824 KiB, score = 10

    测试数据 #6: Accepted, time = 31 ms, mem = 820 KiB, score = 10

    测试数据 #7: Accepted, time = 93 ms, mem = 820 KiB, score = 10

    测试数据 #8: Accepted, time = 125 ms, mem = 824 KiB, score = 10

    测试数据 #9: Accepted, time = 140 ms, mem = 824 KiB, score = 10

    Accepted, time = 435 ms, mem = 824 KiB, score = 100

    代码
    var i,k,l,n:int64;
    begin
    l:=1;
    read(n);
    while i<>n do
    begin
    i:=i+1;
    k:=k+1;
    l:=l+k;
    end;
    writeln(l);
    end.

  • 0
    @ 2013-08-22 21:00:22

    PYTHON:

    a=int(raw_input())
    print a*(a+1)/2+1

  • 0
    @ 2012-10-11 21:35:25

    AC 30题纪念~ 好简单。。。

    水题

    。。。

  • 0
    @ 2012-08-04 13:42:17

    坑爹~你这是切饼啊还是切蛋糕啊~Orz...

  • 0
    @ 2012-07-26 17:54:53

    五行代码

    秒杀一切!!!

    var n:int64;

    begin

    readln(n);

    write(1+(n*(n+1))div 2);

    end.

    注意结果很大!!!

    longint会爆

  • 0
    @ 2010-07-13 16:10:02

    program vijos_1324;

    var

    n,i:longint;

    a:int64;

    begin

    readln(n);

    a:=1;

    for i:=1 to n do

    a:=a+i;

    writeln(a);

    end.

    真不是一般水。。。

  • 0
    @ 2009-11-03 22:13:51

    #include

    using namespace std;

    int main ()

    {

    unsigned long long n;

    cin>>n;

    cout

  • 0
    @ 2009-11-01 11:49:49

    本菜菜菜菜鸟AC50题!

  • 0
    @ 2009-10-30 20:44:19

    首先,由于大多数人拷贝题解(程序很短)通过人数飙升

    第二,我到现在还没有过.....

信息

ID
1324
难度
3
分类
其他 | 数学 点击显示
标签
递交数
1825
已通过
919
通过率
50%
被复制
2
上传者