[刷题] PTA 7-35 猴子吃桃问题

程序:

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

 

posted @ 2019-04-16 22:00  cxc1357  阅读(698)  评论(0编辑  收藏  举报