Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define NMax 1000001
- using namespace std;
- ifstream f("greselile.in");
- ofstream g("greselile.out");
- int dp[NMax],p[NMax];
- int nr,n,t,x;
- int main()
- {
- f >> n >> t;
- for(int i = 2; i <= n; i++){
- for(int j = i + i; j <= n; j += i){
- dp[j] = max(dp[i] + 1,dp[j]);
- }
- }
- for(int i = 1; i <= t; ++i){
- f >> x;
- g << dp[x] + 1<< '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement