a005.
Eva 的回家作業
--
POJ
| From: [180.169.10.222] |
發表日期
:
2014-05-28 16:46
報錯為:正確輸出為 2 4 6 8 10 我的輸出為:1 1 1 1 1
但是我自己測試沒有問題
import java.util.*;
public class NumberOfColumns
{
public static void main ( String [] args )
{
int i = 0;
int a,b,c,d;
StringBuilder sb = new StringBuilder();
Scanner sc = new Scanner( System.in );
if ( sc.hasNext() )
i = sc.nextInt();
for ( ; i > 0; i-- )
{
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
d = sc.nextInt();
if ( b - a == c - b && c - b == d - c )
sb.append( a ).append( " " ).append( b ).append( " " ).append( c )
.append( " " ).append( d ).append( " " ).append( d + c - b ).append( "\n" );
if ( b / a == c / b && c / b == d / c )
sb.append( a ).append( " " ).append( b ).append( " " ).append( c )
.append( " " ).append( d ).append( " " ).append( d * c / b ).append( "\n" );
}
System.out.println( sb.toString() );
}
}