您的位置:首页 > 编程语言 > C语言/C++

[置顶] 信息学奥赛一本通(C++版) 第一部分 C++语言 第一章 C++语言入门

2017-10-19 20:06 543 查看
信息学奥赛一本通(C++版)  第一部分 C++语言   第一章 C++语言入门
http://ybt.ssoier.cn:8088/
//1000 入门测试题目

#include <stdio.h>

int main(){

    int a,b;

    scanf("%d%d",&a,&b);

    printf("%d\n",a+b);

    return 0;

}

//1001 Hello,World!

#include <stdio.h>

int main(){

    printf("Hello,World!");

    return 0;

}

//1002 输出第二个整数

#include <stdio.h>

int main(){

    int a,b,c;

    scanf("%d%d%d",&a,&b,&c);

    printf("%d",b);

    return 0;

}

//1003 对齐输出

#include <stdio.h>

int main(){

    int a,b,c;

    scanf("%d%d%d",&a,&b,&c);

    printf("%8d %8d %8d",a,b,c);

    return 0;

}

//1004 字符三角形

#include <stdio.h>

int main(){

    char s[2];

    scanf("%s",s);

    printf("  %c  \n %c%c%c \n%c%c%c%c%c",s[0],s[0],s[0],s[0],s[0],s[0],s[0],s[0],s[0]);

    return 0;

}

//1005 地球人口承载力估计

//基本思路,每年的再生资源刚好被消耗,现有资源不消耗,才能可持续发展

//c+d*a=x*a

//c+d*b=y*b

//d*(b-a)=y*b-x*a

//d=(y*b-x*a)/(b-a)

#include <stdio.h>

int main(){

    int x,a,y,b;

    scanf("%d%d%d%d",&x,&a,&y,&b);

    printf("%.2f",(y*b-x*a)*1.0/(b-a));

    return 0;

}

2017-10-19 20:46 AC该章节
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐