题目描述
给同学分苹果,若每人分 个就剩下 个;如果每人分 个则少一个,请问有多少同学,有多少个苹果?
输入格式
不需要输入。
输出格式
请输出两个整数表示答案,使用空格隔开。
题目分析
目的:求出有多少同学,有多少个苹果。
设学生人数为 x,苹果数量为 y,则:
则,可推出:
代码实现
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 1e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << 12 << " " << 47;
return 0;
}