A. Ichihime and Triangle 叮叮叮

time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output

Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.

These days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this time the prize for the winner is her favorite — cookies. Ichihime decides to attend the contest. Now she is solving the following problem.

You are given four positive integers a, b, c, d, such that a≤b≤c≤d.

Your task is to find three integers x, y, z, satisfying the following conditions:

a≤x≤b.
b≤y≤c.
c≤z≤d.
There exists a triangle with a positive non-zero area and the lengths of its three sides are x, y, and z.
Ichihime desires to get the cookie, but the problem seems too hard for her. Can you help her?

Input
The first line contains a single integer t (1≤t≤1000) — the number of test cases.

The next t lines describe test cases. Each test case is given as four space-separated integers a, b, c, d (1≤a≤b≤c≤d≤109).

Output
For each test case, print three integers x, y, z — the integers you found satisfying the conditions given in the statement.

It is guaranteed that the answer always exists. If there are multiple answers, print any.

Example
inputCopy
4
1 3 5 7
1 5 5 7
100000 200000 300000 400000
1 1 977539810 977539810
outputCopy
3 4 5
5 5 5
182690 214748 300999
1 977539810 977539810
Note
One of the possible solutions to the first test case:

题目大意就是三角形的三条边分别在区间 a,b b,c c,d 之间 可以取等,给你四个数代表可取的范围让你在这个范围里任意找三条边 组成个三角形。

哈哈 我看看有多少人 条件反射般的想到了 三个for循环 然后超时!!(可难坏本宝宝啦)!
题目是任意一个三角形 所以不用考虑什么直角 钝角的 想想就很麻烦!!
首先想要组成个三角形 什么三角形最简单 ?? 等腰三角形呀! 哎,思路不就来了吗 分别找区间对应的临界值呀 这不就出来了吗 上代码!!

#include<iostream>
#include<cmath>
#include <cstdio>
using namespace std;
int main()
{
   int n;
   cin>>n;
   while(n--)
   {
    int x,y,z,a,b,c,d;
    cin>>a>>b>>c>>d;
    printf("%d %d %d\n",a,c,c); // 也可以是   printf("%d %d %d\n",b,c,c);
   }
}

就这样啦 哈哈 是不是感觉智商有点不在线呀??

上一篇:CSS3三角形不断放大特效


下一篇:3.30刷题记录 Triangle