Openjudge 1.1答案
如有疑问,欢迎评论、私信讨论交流!
01:Hello, World!
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{printf("Hello, World!\n");return 0;
}
02:输出第二个整数
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{int a,b,c;scanf("%d %d %d",&a,&b,&c);printf("%d\n",b);return 0;
}
03:对齐输出
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{int a,b,c;scanf("%d%d%d",&a,&b,&c);printf("%8d %8d %8d\n",a,b,c);return 0;
}
04:输出保留3位小数的浮点数
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{float a;scanf("%f",&a);printf("%.3f\n",a);return 0;
}
05:输出保留12位小数的浮点数
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{double a;scanf("%lf",&a);printf("%.12lf\n",a);return 0;
}
06:空格分隔输出
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{char a;int b;float c;double d;scanf("%c\n%d\n%f\n%lf",&a,&b,&c,&d);printf("%c %d %.6f %.6lf\n",a,b,c,d);return 0;
}
07:输出浮点数
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{double d;scanf("%lf",&d);printf("%f\n%.5lf\n%e\n%g\n",d,d,d,d);return 0;
}
08:字符三角形
#include <stdio.h>int main()
{char a;scanf("%c",&a);printf(" %c\n\%c%c%c\n\
%c%c%c%c%c\n",a,a,a,a,a,a,a,a,a);return 0;}
09:字符菱形
#include <stdlib.h>
#include <stdbool.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main()
{char d;scanf("%c",&d);printf(" %c\n",d);printf(" %c%c%c\n",d,d,d);printf("%c%c%c%c%c\n",d,d,d,d,d);printf(" %c%c%c\n",d,d,d);printf(" %c",d);return 0;
}
10:超级玛丽游戏
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{cout<<" ********"<<endl;cout<<" ************"<<endl;cout<<" ####....#."<<endl;cout<<" #..###.....##...."<<endl;cout<<" ###.......###### ### ### ### ###"<<endl;cout<<" ........... #...# #...# #...# #...#"<<endl;cout<<" ##*####### #.#.# #.#.# #.#.# #.#.#"<<endl;cout<<" ####*******###### #.#.# #.#.# #.#.# #.#.#"<<endl;cout<<" ...#***.****.*###.... #...# #...# #...# #...#"<<endl;cout<<" ....**********##..... ### ### ### ###"<<endl;cout<<" ....**** *****...."<<endl;cout<<" #### ####"<<endl;cout<<" ###### ######"<<endl;cout<<"############################################################## ##################################"<<endl;cout<<"#...#......#.##...#......#.##...#......#.##------------------# #...#......#.##------------------#"<<endl;cout<<"###########################################------------------# ###############------------------#"<<endl;cout<<"#..#....#....##..#....#....##..#....#....##################### #..#....#....#####################"<<endl;cout<<"########################################## #----------# ############## #----------#"<<endl;cout<<"#.....#......##.....#......##.....#......# #----------# #.....#......# #----------#"<<endl;cout<<"########################################## #----------# ############## #----------#"<<endl;cout<<"#.#..#....#..##.#..#....#..##.#..#....#..# #----------# #.#..#....#..# #----------#"<<endl;cout<<"########################################## ############ ############## ############"<<endl;return 0;
}
Openjudge 1.1答案相关推荐
- [转]信息安全相关理论题(三)
21.静态分析是运行程序后进行调试? A. 对 B. 错 您的答案: 标准答案: B 22.安卓反编译后会出现$符号字节码表示是匿名内部类? A. 对 B. 错 您的答案: 标准答案: A 23.反编 ...
- 北大郭炜慕课程序设计与算法(一)C++的OpenJudge题目答案
北大郭炜慕课程序设计与算法(一)C++的OpenJudge题目答案 学习心得 题目答案 001 输出第二个整数 002 字符菱形 003 打印ASCII码 004 打印字符 005 整型数据类型存储空 ...
- openjudge用c语言答案,OpenJudge - NOI - 1.4编程基础之逻辑表达式与条件分支(C语言 全部题解)...
01:判断数正负 #include int main(void) { int num; scanf("%d", &num); if (num > 0) { print ...
- OpenJudge NOI题库1.1答案
我是一位编程爱好者,大家可以看我的代码进行学习,这些代码都是通过测试的.(仅供参考) 01.Hello, World! #include<bits/stdc++.h> using name ...
- 信息学奥赛一本通 1242:网线主管 | OpenJudge NOI 1.11 04:网线主管
[题目链接] ybt 1242:网线主管 OpenJudge NOI 1.11 04:网线主管 [题目考点] 1. 二分答案 [解题思路] 看题目中的数据都带小数点,似乎这是实数域上的问题.但仔细分析 ...
- [OpenJudge 3066]随机序列
[OpenJudge 3066]随机序列 试题描述 Bob喜欢按照如下规则生成随机数: 第一步:令a[0] = S, 当n = 0: 第二步:a[n+1] = (a[n]*A+B)%P: 第三步:如果 ...
- OpenJudge NOI 2.1 1752:鸡兔同笼
[题目链接] OpenJudge NOI 2.1 1752:鸡兔同笼 [题目考点] 1. 枚举 [解题思路] 解法1:枚举 设有鸡x只,兔子y只,已知有a只脚,那么有 2x+4y=a2x+4y=a2x ...
- Python入门习题(63)——OpenJudge百练习题:DNA排序
OpenJudge百练第1007号习题:DNA排序 题目描述 解题思路 参考答案 测试用例 小结 题目描述 来源 OpenJudge网站 – 百练习题集-第1007号习题 建议学编程的人士利用好这个网 ...
- 大象喝水编程c语言,OpenJudge计算概论-大象喝水
/*========================================================= 大象喝水 总时间限制: 1000ms 内存限制: 65536kB 描述 一只大象 ...
最新文章
- python的历史 常量 注释 基础数据类型等基本操作 和if 判断语句
- Python 面试总结
- 关于IOS给我的启发
- 如何采用锂离子电池提高数据中心电源效率
- server 2008 IIS 7下asp.net开发环境部署及配置
- 《敏捷敬业度》作者访谈
- 如何在业务层实现响应缓存
- python获取网页源码被拒绝_Python3 请求网页源码 目标计算机积极拒绝,无法连接...
- asp.net web submit链接页面_De1CTF2020的Web部分题解
- PHP程序员五大兵器排行
- Intel CPU 曝两个新漏洞影响所有处理器,设备可遭接管(含视频)
- hdu--1160--LIS+打印路径
- c语言 格式字符,c语言的格式符
- 向量积的坐标运算公式推导_向量外积的直接证明与直观解释,并以此证明正弦公式...
- Hibernate中类的继承使用union-subclass实现
- html语言div怎么使用,什么是div标签?HTML中div标签怎么使用?
- 关于Banner制作有感(antD+react)
- 10分钟内用Ezo和Python构建以太坊Oracle
- 泰凌微TLSR825X开发一蓝牙通信实例
- 一个隐藏android应用图标的方法
热门文章
- APP通过http获取OneNet数据与命令下发【应用层】
- 什么是FPGA fpga的核心作用
- 基于SVM.NET的验证码识别算法实现
- python循环语句continue_Python循环控制语句中的break和continue语句
- Cortex-A7中断详解(二)
- vscode 放大缩小代码
- android读出序列号,获取android手机序列号
- 2017第八届蓝桥杯(C/C++ B组)C语言解法---等差数列
- 软银中国在华首次投资AI公司,码隆科技获2.2亿B轮融资
- SSM、SSH框架 | Mybatis | Spring | Maven