11.02~11.16大周总结。

来源:互联网 发布:淘宝店主自拍技巧 编辑:程序博客网 时间:2024/06/08 13:16

今天灵魂刚刚上线,就遇到了这么一题。

(简化):农民XXX病的不轻,但是!他还是坚持去刷栅栏。他的奶牛看不下去了,于是来帮他刷。

看到这道题,(浮想出考试的情景)于是,我敲了:

  • #inlude<biys/stdc++.h>
  • using namespace std;
  • int main()
  • {
  • int a,b,c,d,f,n;/f是农民刷的栅栏数,n是牛刷的栅栏数;
  • cin>>a>>b>>c>>d;
  • f=b-a;
  • n=d-c;
  • cout<<f+n<<endl;
  • return 0;
  • }
我都不知道我是怎么想的,这做法能让我窒息!!!敲打

一刷。。。。。

呵呵,没有超出意料,连样例都没过。。。

所以,由不得已重敲了一遍。。。。

  • #inlude<biys/stdc++.h>
    using namespace std;
    int main()
    {
    int a,b,c,d,f,n;/f是农民刷的栅栏数,n是牛刷的栅栏数;
    cin>>a>>b>>c>>d;
    f=b-a;
    n=d-c;
    cout<<f+n<<endl;
    return 0;
    }
源代码里加了点小修改。。。
    • #inlude<biys/stdc++.h>
    • using namespace std;
    • int main()
    • {
    • int a,b,c,d,f,n;/f是农民刷的栅栏数,n是牛刷的栅栏数;
    • cin>>a>>b>>c>>d;
    • if(b<c||a>d)
    • f=b-a;
    • n=d-c;
    • cout<<f+n<<endl;
    • else
    • if(b>c)
    • f=b-a;
    • n=d-c;
    • cout<<f+n+b-c<<endl;
    • return 0;
    • }
    呵呵!
  • 为甚么!!!!
  • 60分!!!
  • 于是苦恼了半小时,想到了结果。。
  • 当c=b时,是要减一的。。。。
  • 于是我又来了一遍。。。。
    • #inlude<biys/stdc++.h>
    • using namespace std;
    • int main()
    • {
    • int a,b,c,d,f,n;/f是农民刷的栅栏数,n是牛刷的栅栏数;
    • cin>>a>>b>>c>>d;
    • if(b<c||a>d)
    • f=b-a;
    • n=d-c;
    • cout<<f+n<<endl;
    • else
    • if(b>c)
    • f=b-a;
    • n=d-c;
    • cout<<f+n+b-c<<endl;
    • else
    • if(a<d)
    • f=b-a;
    • n=d-c;
    • cout<<f+n+b-c<<endl;
    • else
    • if(a==d||b++c)
    • f=b-a;
    • n=d-c;
    • cout<<f+n-1<<endl;
    • return 0;
    • }
    • huhuhu
    • 终于完事了;
    • 总算骗过分了。。。
    • GAME  OVER!

原创粉丝点击