[HDU] [2013] Peach Story

Problem Description

Loading...

Problem Analysis

A pretty interesting one
and I got to see all kinds of cute quirks from problem setters
Nothing much to say about the problem itself
Working backwards makes it quite easy

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include<stdio.h>
int main() {
    int n,i;
    while(scanf("%d",&n)!=EOF) {
        for(i=1; n!=1; n--)
            i=(i+1)*2;
        printf("%d\n",i);
    }
    return 0;
}

Loading...