CSU 1715 Positive Con Sequences

Positive Con Sequences

Time Limit: 1 Sec   Memory Limit: 128 MB
Submit: 554   Solved: 118
[ Submit][ Status][ Web Board]

Description

Input

Output

Sample Input

1 2 -1 4
2 4 8 -1
7 8 -1 21
5 -1 11 14
-1 2 4 6
-1 -1 -1 -1

Sample Output

3
16
-1
8
-1


#include
#include
#include
#include
using namespace std;
int main(){
    int a, b, c, d, k;
    while(~scanf("%d%d%d%d",&a,&b,&c,&d)){
        if(a==-1&&b==-1&&c==-1&&d==-1)
            break;
        if(a==-1){
            k = d-c;
            a = b-k;
            if(a+k==b&&b+k==c&&c+k==d){
                if(a>=1&&a<=10000){
                    cout<=1&&a<=10000){
                    cout<=1&&b<=10000){
                    cout<=1&&b<=10000){
                    cout<=1&&c<=10000){
                    cout<=1&&c<=10000){
                    cout<=1&&d<=10000){
                    cout<=1&&d<=10000){
                    cout<




你可能感兴趣的:(小水,水)