Submission #66812997
Source Code Expand
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
using namespace std;
//constexpr long long int MOD = 1000000007;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;
//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;
long long gcd(long long a, long long b) {
while (b) {
a %= b;
swap(a, b);
}
return a;
}
long long ten(long long num) {
long long ret = 1;
for (int i = 1; i < num; i++)ret *= 10;
return ret;
}
void Solve() {
int a, b, c;
cin >> a >> b >> c;
if (a > c || b > c) {
cout << "No\n";
return;
}
if (a + b < c) {
cout << "No\n";
return;
}
cout << "Yes\n";
if (a == c || b == c) {
cout << ten(a) << " " << ten(b) << endl;
return;
}
long long num = 1;
for (int i = 0; i < a + b - c; i++) {
num *= 10;
}
int m = a + b - c;
a -= m;
b -= m;
long long anum = ten(a + 1) - 1, bnum = ten(b + 1) - 1;
if (anum >= bnum) {
while (gcd(anum, bnum) > 1)anum--;
}
else{
while (gcd(anum, bnum) > 1)bnum--;
}
cout << anum * num << " " << bnum * num << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> T;
while (T--) {
Solve();
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - LCM |
| User | olphe |
| Language | C++ 23 (gcc 12.2) |
| Score | 600 |
| Code Size | 1552 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3572 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3564 KiB |
| 01_handmade_00.txt | AC | 3 ms | 3432 KiB |
| 01_handmade_01.txt | AC | 7 ms | 3572 KiB |
| 01_handmade_02.txt | AC | 2 ms | 3412 KiB |