题解

27 条题解

  • 3
    @ 2017-10-06 21:27:35

    So Water!!!!!!!!!!!!

    #include<iostream>
    using namespace std;
    int main()
    {
    long long n,a,m,t=0;
    cin>>m>>n;
    for(int i=1;i<=n;i++)
    {
    a=m/2;
    t+=a;
    m=m-a;
    }
    cout<<t;
    }

  • 1
    @ 2017-11-04 13:48:57

    刷道模拟冷静一下
    cpp
    #include<cstdio>
    using namespace std;
    int main()
    {
    int n,m,sum=0;
    scanf("%d%d",&m,&n);
    while(n)
    {
    n--;
    sum+=m/2;
    m-=m/2;
    }
    printf("%d",sum);
    return 0;
    }

  • 0
    @ 2018-08-01 21:55:41

    水炸了

    var
    a,b,c,d,i:longint;
    begin
    readln(a,b);
    for i:=1 to b do
    begin
    c:=a div 2;
    a:=a-c;
    d:=d+c;
    end;
    writeln(d);
    end.

  • 0
    @ 2017-08-09 12:57:01

    public class y {

    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in );
    String line = sc.nextLine();
    String[] list=line.split(" ");
    int sum= Integer.parseInt(list[0]) ;
    int times= Integer.parseInt(list[1]) ;
    int outman=0;
    for (int i = 0; i < times; i++) {
    outman+=sum/2;
    sum=sum-sum/2;

    }
    System.out.println("outman");

    }

    }

  • 0
    @ 2016-12-22 00:43:27

    还能再水一点吗
    ```c

    #include<stdio.h>
    int main()
    {
    int m,n;
    int count = 0,sum = 0;
    scanf("%d%d",&m,&n);
    while(1)
    {
    sum += m/2;
    m = m-m/2;
    count++;
    if(count == n) break;
    }
    printf("%d\n",sum);
    return 0;
    }

  • 0
    @ 2016-11-17 23:51:00
    #include<iostream>
    int main()
    {
        int m,n,a=0;
        for(std::cin>>m>>n;n--;m-=m/2)a+=m/2;
        std::cout<<a;
    }
    
  • 0
    @ 2016-09-25 13:04:53
    program P1785;
    var
      m,n,ans,i:longint;
    begin
      readln(m,n);
      ans:=0;
      for i:=1 to n do
        begin
          ans:=ans+(m div 2);
          m:=m-(m div 2);
        end;
      writeln(ans);
    end.
    
  • 0
    @ 2016-05-23 22:32:30
    记录信息
    评测状态    Accepted
    题目  P1785 同学排序
    递交时间    2016-07-04 13:37:05
    代码语言    C++
    评测机 ShadowShore
    消耗时间    30 ms
    消耗内存    504 KiB
    评测时间    2016-07-04 13:37:05
    评测结果
    编译成功
    
    测试数据 #0: Accepted, time = 0 ms, mem = 500 KiB, score = 20
    测试数据 #1: Accepted, time = 0 ms, mem = 504 KiB, score = 20
    测试数据 #2: Accepted, time = 15 ms, mem = 504 KiB, score = 20
    测试数据 #3: Accepted, time = 0 ms, mem = 500 KiB, score = 20
    测试数据 #4: Accepted, time = 15 ms, mem = 504 KiB, score = 20
    Accepted, time = 30 ms, mem = 504 KiB, score = 100
    代码
    #include<stdio.h>
    int main() {
      int n,m,ans=0;
      scanf("%d %d",&n,&m);
      for (int i=1;i<=m;i++) {
        ans+=n/2;
        n-=n/2;
      }
      printf("%d",ans);
      return 0;
    }
    
  • 0
    @ 2016-03-30 15:42:08

    var
    n,m,ans,sum:longint;
    begin
    readln(n,m);
    ans:=0;
    sum:=0;
    repeat
    sum:=sum+n div 2;
    n:=n-(n div 2);
    inc(ans);
    until ans=m;
    writeln(sum);
    end.

  • 0
    @ 2016-02-26 13:49:33

    水题啦
    var
    m,n,s,i:longint;
    begin
    readln(m,n);
    s:=0;
    for i:=1 to n do
    begin
    s:=m div 2+s;
    m:=m div 2+m mod 2;
    end;
    write(s);
    end.

  • 0
    @ 2016-01-08 20:08:45

    水题,还有17RP
    #include<iostream>
    using namespace std;
    int main()
    {
    long long a,b,n,t=0;
    cin>>n>>a;
    for (int i=1;i<=a;i++)
    {
    b=n/2;
    t+=b;
    n=n-b;
    }
    cout<<t;
    }

  • 0
    @ 2015-11-21 19:43:00

    program xie;
    var
    m,n,p,i,j,b,c,k:longint;
    a:array[1..100000]of longint;
    begin
    readln(m,n);
    c:=0; p:=1;
    for i:=1 to m do
    begin
    a[i]:=i;
    if a[i] mod 2=0 then a[i]:=0;
    end;
    k:=n-1;
    for b:=1 to k do
    begin
    p:=1;
    for i:=1 to m do
    begin
    if a[i]<>0 then begin a[i]:=p; inc(p); end;
    if a[i] mod 2=0 then a[i]:=0;
    end;
    end;
    for b:=1 to m do
    if a[b]=0 then inc(c);
    writeln(c);
    end.
    好水的题目,连排序都几乎不要

  • 0
    @ 2015-11-06 22:06:31

    编译成功

    测试数据 #0: Accepted, time = 0 ms, mem = 516 KiB, score = 20
    测试数据 #1: Accepted, time = 0 ms, mem = 520 KiB, score = 20
    测试数据 #2: Accepted, time = 0 ms, mem = 516 KiB, score = 20
    测试数据 #3: Accepted, time = 0 ms, mem = 516 KiB, score = 20
    测试数据 #4: Accepted, time = 15 ms, mem = 516 KiB, score = 20
    Accepted, time = 15 ms, mem = 520 KiB, score = 100
    代码
    #include<iostream>
    #include<math.h>
    #include<fstream>
    using namespace std;
    int main()
    {
    int n,m,k=0,b;
    cin>>m>>n;
    for(int i=1;i<=n;i++)
    {
    b=m;
    m=m/2;
    k=k+m;
    m=b-m;
    }
    cout<<k<<endl;
    return 0;
    }

  • 0
    @ 2014-12-20 17:35:25

    这题目真心水……话说回来和排序有关吗?

    ###Block Code

    var
    n,k,i,x,ans:longint;
    begin
    readln(n,k);
    ans:=0;
    for i:=1 to k do
    begin
    x:=n div 2;
    ans:=ans+x;
    n:=n-x;
    end;
    writeln(ans);
    end.

  • 0
    @ 2014-10-15 21:41:34

    #include <iostream>
    using namespace std;
    int main (){
    int n,m,ans=0;
    cin>>m>>n;
    while (n--){
    ans+=m/2;
    m=(m+1)/2;
    }
    cout<<ans;
    return 0;
    }

  • 0
    @ 2014-08-08 18:29:44

    #include <stdio.h>
    int main(){
    int studentNum,time,rest;
    scanf("%d %d",&studentNum,&time);
    rest=studentNum;
    while(time>=1){
    rest=(rest+1)/2;
    times--;
    }
    printf("%d\n",studentNum-rest);
    return 0;
    }

    好水的题,数据范围应该调到m,n<=10000000

  • 0
    @ 2014-05-08 00:23:53

    这样也够短,不知道可不可以
    var n,m:longint;
    begin
    readln(m,n);
    if m mod (1 shl n)=0 then writeln(m-m shr n) else writeln(m-m shr n-1);
    end.

  • 0
    @ 2014-01-01 12:02:37

    Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
    有疑问请留言 共同进步

  • 0
    @ 2013-11-06 18:10:35

    1分钟秒杀

    记录信息
    评测状态 Accepted
    题目 P1785 同学排序
    递交时间 2013-11-06 18:09:49
    代码语言 C++
    评测机 上海红茶馆
    消耗时间 15 ms
    消耗内存 568 KiB
    评测时间 2013-11-06 18:09:50
    评测结果

    编译成功

    测试数据 #0: Accepted, time = 15 ms, mem = 564 KiB, score = 20

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

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

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

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

    Accepted, time = 15 ms, mem = 568 KiB, score = 100
    代码

    #include <stdio.h>
    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <math.h>
    #include <cstdlib>

    using namespace std;

    int m , n;
    int M;

    int main()
    {
    while( scanf( "%d %d" , &m , &n ) != EOF )
    {
    M = m;
    while( n-- )
    if( m % 2 == 0 )
    m /= 2;
    else
    m = ( m + 1 ) / 2;
    cout << M - m << endl;
    }
    return 0;
    }

信息

ID
1785
难度
2
分类
模拟 点击显示
标签
(无)
递交数
910
已通过
550
通过率
60%
被复制
1
上传者