【DidaOJ】[1141]Find a Number in a Sequence

Problem Description

Loading...

Problem Analysis

​ A pattern-finding problem
Pretty easy warm-up problem

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<stdio.h>
int main(){
    int t,b,g;
    scanf("%d",&t);
    while(t--){
    scanf("%d %d",&b,&g);   
    if(g==0)
    printf("0\n");
    else
    printf("%d\n",b+2*g);
    }
    return 0;
}

Problem link: 【DidaOJ】[1141] Find the Number in the Sequence

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...