题解:P14495 [NCPC 2025] Arithmetic Adaptation
一道模拟题,按照题意枚举即可,但是要注意判断a和b是否为0,题目规定了a和b不能为0。
代码如下:
#include
using namespace std;
int main()
{
int s;
cin>>s;
for(int i=-999;i<=999;i++)
{
for(int j=-999;j<=999;j++)
{
if(i+j==s and i!=0 and j!=0)
{
cout<
洛谷发布日期为2025-11-13 21:49
原文链接
返回主页