Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
                                                        C++ Programming
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin>>t;
  while(t--){
    int n;
    cin>>n;
    int ans;
    if(n == 1){
      ans = 2;
    }
    else if(n % 3 != 0){
      ans = n/3 + 1;
    }
    else{
      ans = n/3;
    }
    cout<<ans<<endl;
  }
}Input
                                                            4
1
3
4
12
                                                    1
3
4
12
Output
                                                            2
1
2
4
                                                    1
2
4
Demonstration
Codeforcess Solution 1716-A A. 2-3 Moves ,C++, Java, Js and Python,1716-A,Codeforcess Solution
