ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#167260 | #966. 兔兔 | struct | 100 | 1ms | 1200kb | C++ | 486b | 2023-01-01 22:15:36 | 2023-01-01 22:15:38 |
answer
//There's the KPEN code.
//如果1只兔可换2只鸡,2只兔可换3只鸭,5只兔可换7只鹅.某人用n只兔换得鸡、鸭、鹅共m只.问:其中的鸡、鸭、鹅各多少只?
#include<bits/stdc++.h>
using namespace std;
//开始进入C++的世界
int n,m;
int main() {
int c;
cin>>n>>m;
for(int i=1; i<=m; i++) {
for(int j=1; j<=m; j++) {
c=m-i-j;
if(21*i+28*j+30*c==42*n&&c>0) {
cout<<i<<' '<<j<<' '<<c<<'\n';
}
}
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 20
Accepted
time: 0ms
memory: 1196kb
input:
20 30
output:
2 21 7 4 12 14 6 3 21
result:
ok 3 lines
Test #2:
score: 20
Accepted
time: 0ms
memory: 1200kb
input:
30 50
output:
22 21 7 24 12 14 26 3 21
result:
ok 3 lines
Test #3:
score: 20
Accepted
time: 0ms
memory: 1196kb
input:
446 650
output:
2 375 273 4 366 280 6 357 287 8 348 294 10 339 301 12 330 308 14 321 315 16 312 322 18 303 329 20 29...
result:
ok 42 lines
Test #4:
score: 20
Accepted
time: 1ms
memory: 1196kb
input:
153 221
output:
2 93 126 4 84 133 6 75 140 8 66 147 10 57 154 12 48 161 14 39 168 16 30 175 18 21 182 20 12 189 22 3...
result:
ok 11 lines
Test #5:
score: 20
Accepted
time: 0ms
memory: 1196kb
input:
123 217
output:
132 78 7 134 69 14 136 60 21 138 51 28 140 42 35 142 33 42 144 24 49 146 15 56 148 6 63
result:
ok 9 lines