Time Exceeded
Code
#include<bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define endl '\n'
#define ll long long
#define test_case int t;cin>>t;while(t--)
//const int mx=2e5+123;
// long long dp[mx];
int fun(int n){
if(n==0) return 0;
if(n<0) return 1e9;
int m1,m2;
m1=fun(n-2)+1;
m2=fun(n-3)+1;
return min(m1,m2);
}
int main(){
FAST_IO;
int n;
cin>>n;
cout<<fun(n);
}
Information
- Submit By
- Type
- Submission
- Problem
- P1106 too easy or three easy
- Contest
- Brain Booster #6
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-10-03 15:41:04
- Judged At
- 2024-12-17 11:36:21
- Judged By
- Score
- 10
- Total Time
- ≥1092ms
- Peak Memory
- ≥548.0 KiB