惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
雷峰网
雷峰网
I
InfoQ
罗磊的独立博客
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
博客园 - 三生石上(FineUI控件)
The GitHub Blog
The GitHub Blog
K
Kaspersky official blog
P
Privacy & Cybersecurity Law Blog
S
SegmentFault 最新的问题
T
Threat Research - Cisco Blogs
H
Help Net Security
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CERT Recently Published Vulnerability Notes
WordPress大学
WordPress大学
T
Tenable Blog
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - Franky
A
Arctic Wolf
T
Threatpost
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
G
GRAHAM CLULEY
Security Latest
Security Latest
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
S
Schneier on Security
Latest news
Latest news
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com

Ayx 博客

PaperMC 服务器允许刷线机/无头活塞等配置 如何从 YouTube 搬运视频?如何做一个合格的 YouTube 搬运工?我搬运视频的方法与原则 此博客的所有镜像 免费获取在 Microsoft Store 中收费 ¥7.00 的 HEVC 视频扩展 CLI Post Test moefox.tech 已于 7 月 25 日过期,本站域名已更换为 imayx.top 关于 链接 LG V50 ThinQ 韩版 LGU+ 从解锁 BootLoader 到破解 VoLTE / NSA 5G、从刷入第三方 Recovery 到硬格、从混刷到黑砖全教程 Python 3 入门学习笔记 新年快乐 & 本站的改版 在 Hugo 主题 Stack 中轻松配置 Waline 评论系统 出现 error: ld returned 1 exit status 的五种原因以及解决方法 MySSL 安全签章 题解 P1603 斯诺登的密码 安装 Hugo 主题 Stack 时你可能会遇到的问题 独角兽搜索 Hello Hugo 题解 UPC-1488 客户调查(client) 题解 P5707 【深基2.例12】上学迟到 题解 P2669 [NOIP2015 普及组] 金币 题解 P5719 【深基4.例3】分类平均 分享一下我的博客园在用的修改版 Wider Gao 博客园主题 使用 Node.js(安装Hexo)时出现了 rollbackFailedOptional 错误的解决方法 题解 HDU2063 过山车 题解 P1650 田忌赛马 OJ术语的解释: AC、WA、TLE、OLE、MLE、RE、PE、CE、UKE 都是些啥? 归档 搜索 友链
题解 YBT 1000:入门测试题目
2020-12-04 · via Ayx 博客

梦开始的地方

OpenJudge - 01:A+B问题

信息学奥赛一本通(C++版)在线评测系统

如果非要做这题我推荐第一个 OJ,第二个 OJ 的界面实在惨不忍睹

(虽然第一个题目有题号检索比较方便而且貌似用户比较多)

更好的选择是不要做《信奥赛一本通》的题

题目的背景、描述、输入输出格式样例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1000:入门测试题目

时间限制: 1000 ms         内存限制: 32768 KB

【题目描述】

求两个整数的和。

【输入】

一行,两个用空格隔开的整数。

【输出】

两个整数的和。

【输入样例】

1 2

【输出样例】

3

题意分析与算法设计

新手不用理会 时间限制内存限制,一般来说学到后面才会出现 TLE(Time Limit Exceed,超出时间限制)和 MLE(Memory Limit Exceed,超出内存限制)的情况。

(关于这些术语,可以在这里了解。)

至于这个问题,就是一个最简单的 A+B 问题。

参考用完整代码

各位一定要养成良好的代码风格,因为代码不仅仅是给机器看的,有时候人也要看。

使用 cin/cout(需要调用 iostreeam 头文件):

1
2
3
4
5
6
7
#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	cout << a + b << endl;
}

使用 scanf/printf(需要调用 cstdio 头文件):

1
2
3
4
5
6
7
#include <cstdio>
using namespace std;
int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d", a + b);
}

这两种风格的输入输出各有长处,各位务必都要掌握。

实际上,第二份代码中没有用到任何 C++ 特性,因此不加 using namespace std; 也没关系。


为什么这种题你还要水一篇题解出来


编辑记录

2021-08-06 18:42:00 UTC+8

最后更新于 OCT 19, 2021 21:57 UTC+8