Open utterances-bot opened 1 year ago
https://oj.luyencode.net/problem/PLANT
Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.
#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--){ int n; cin >> n; int sum = 0; for(int i=0;i<=n;i++){ if(i%2==0) sum+=1; else sum*=2; } cout << sum << "\n"; } }
Chi tiết bài tập - Luyện Code Online
https://oj.luyencode.net/problem/PLANT