本题不需要读取输入。
输出若干行,每行包含三个整数,分别代表公鸡、母鸡、小鸡的数量。
1
0 25 75 4 18 78 8 11 81 12 4 84
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int num = sc.nextInt();
int n1 = 0; // 鸡翁个数
int n2 = 0; // 鸡母个数
int n3 = 3; // 鸡雏个数
for(n1 = 0; n1 < 20; n1++){
for(n2 = 0; n2 < 33; n2++){
for(n3 = 0; n3 < 100; n3 = n3 + 3){
if(n1 + n2 + n3 == 100 && 5*n1 + 3*n2 + n3/3 == 100){
System.out.println(n1 + " " + n2 + " " + n3);
}
}
}
}
}
sc.close();
}
}
for i in range(0,25): y = (100 - 7*i)//4 if(((7*i + 4*y) == 100) and (y > 0)): print(str(i)+' '+str(y)+' '+str(100 - y - i))
import java.io.*;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
while((str=br.readLine())!=null){
StringBuilder sb = new StringBuilder();
// 设公鸡X 母鸡Y 小鸡(100-X-Y) 则 5X+3Y+1/3(100-X-Y)=100 化简得 7X+4Y=100;
for(int i=0;i<=13;i++){
for(int j=0;j<=25;j++){
if(7*i+4*j==100){
sb.append(i).append(" ").append(j).append(" ").append(100-i-j).append("\n");
break;
}
}
}
// 设公鸡X 母鸡Y 小鸡(100-X-Y) 则 5X+3Y+1/3(100-X-Y)=100 化简得 7X+4Y=100; Y=(100-7X)/4
// for(int i=0;i<=14;i++){
// int y = (100-7*i)/4;
// if(7*i+4*y==100){
// sb.append(i).append(" ").append(y).append(" ").append(100-i-y).append("\n");
// }
// }
System.out.print(sb.toString());
}
}
} import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int num = sc.nextInt();
// System.out.println("0 25 75");
// System.out.println("4 18 78");
// System.out.println("8 11 81");
// System.out.println("12 4 84");
//
for(int x = 0;x <= 3;x++){
System.out.println((4*x) + " " + (25-7*x) + " " + (3*x+75));
}
}
sc.close();
}
} #include <iostream>
using namespace std;
//计算
//5x+3y+1/3z = 100
//x+y+z = 100
//得出 7x+4y = 100 0<=x<=14 0<=y<=25
int main()
{
int n;
while(cin>>n)
{
for(int i = 0;i<=14;i++)
{
for(int j = 0;j<=25;j++)
{
if(7*i+4*j == 100)
{
int tmp = 100 -i - j;
cout<<i<<" "<<j<<" "<<tmp<<endl;
}
}
}
}
return 0;
} import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
List<String> s = new ArrayList<String>();
for(int i=0; i<=100; i++) {
for(int j=0; j<=100; j++) {
int k = 100-i-j;
if(k%3==0 && 5*i+3*j+k/3==100) {
s.add(i+" "+j+" "+k);
}
}
}
for(String ss : s) {
System.out.println(ss);
}
}
}
} #include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
int num = 0;
while (cin >> num) {
vector<tuple<int,int,int>> res;
for (int i = 0; i <= 20; i++)
for (int j = 0; j <= (100 - 5 * i) / 3; j++)
for (int k = 0; k <= 3 * (100 - 5 * i - 3 * j); k += 3)
if (i + j + k == 100 && 5 * i + 3 * j + k / 3 == 100)
res.push_back(make_tuple(i, j, k));
for (auto t : res)
cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
}
}
import java.util.Scanner;
public class Demo32 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int num = sc.nextInt();
calculate();
}
sc.close();
}
public static void calculate(){
for(int i=0;i<=20;i++){
for(int j=0;j<=33;j++){
for(int k=0;k<=300;k++){
if(15*i+9*j+k==300&&i+j+k==100){
System.out.println(i+" "+j+" "+k);
}
}
}
}
}
}
老铁们,我做的对吗
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int num=sc.nextInt();
System.out.println(0+" "+25+" "+75);
System.out.println(4+" "+18+" "+78);
System.out.println(8+" "+11+" "+81);
System.out.println(12+" "+4+" "+84);
} }
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
int main()
{ int n; while(cin>>n) { for(int i=0;i<=20;i++) for(int j=0;j<=33;j++) { int k = 100-i-j; if(k%3==0 && 5*i+3*j+k/3==100 && k>=0) cout<<i<<" "<<j<<" "<<k<<endl; } } return 0;
} import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNextInt()){
int n = sc.nextInt();
for(int n1 = 0 ; n1 < 14;n1++){
for(int n2 = 0; n2 <= 25;n2++){
if(7*n1+4*n2==100){
int n3 = 100 - n1 - n2;
System.out.println(n1+" "+n2+" "+n3);
}
}
}
}
sc.close();
}
}