#include <stdio.h>
int main() {
int K, M;
scanf("%d %d", &K, &M);
int trees = 1; // Initially one tree with value 2
for (int i = 0; i < K; i++) {
int V = trees % M;
trees -= 1; // Cut the tree
trees += (V + 1) % M; // Plant (V+1)%M trees
}
printf("%d\n", trees);
return 0;
}
C language
Telegram:- @allcoding1
int main() {
int K, M;
scanf("%d %d", &K, &M);
int trees = 1; // Initially one tree with value 2
for (int i = 0; i < K; i++) {
int V = trees % M;
trees -= 1; // Cut the tree
trees += (V + 1) % M; // Plant (V+1)%M trees
}
printf("%d\n", trees);
return 0;
}
C language
Telegram:- @allcoding1
👍14🥰4
🎯Cisco Hiring Graduate Trainee
Qualifications: Bachelor's/ Master's
Salary: 7 - 9 LPA (Expected)
Batch: 2020/ 2021/ 2022/ 2023/ 2024
Location: PAN India
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
Qualifications: Bachelor's/ Master's
Salary: 7 - 9 LPA (Expected)
Batch: 2020/ 2021/ 2022/ 2023/ 2024
Location: PAN India
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
👍6
🎯GeeksForGeeks Mega Job A Thon Hiring Challenge for Freshers | 3-12 LPA
Job Role : Software Engineer
Qualification : B.E/B.Tech
Experience : Freshers
Package : 3-12 LPA
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
Job Role : Software Engineer
Qualification : B.E/B.Tech
Experience : Freshers
Package : 3-12 LPA
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
👍6👏3😁2
🎯KPMG Hiring HR Operations/ Analyst
Qualifications: Graduate/ Post Graduate
Salary: 5 - 8.6 LPA (Expected)
Batch: 2017/ 18/ 19/ 20/ 21/ 22/ 23
Experience: 0 - 1 (Years)
Location: PAN India/ WFH
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
Qualifications: Graduate/ Post Graduate
Salary: 5 - 8.6 LPA (Expected)
Batch: 2017/ 18/ 19/ 20/ 21/ 22/ 23
Experience: 0 - 1 (Years)
Location: PAN India/ WFH
Apply Now:- http://www.joboffersadda.com
Telegram:- @allcoding1
👍6
🎯Advarra Hiring Software Test Engineer
Qualifications: Any Graduate
Salary: 6 LPA (Expected)
Batch: 2018/ 19/ 20/ 21/ 22/ 23
Experience: 0 - 1 (Years)
Location: Work From Home
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Qualifications: Any Graduate
Salary: 6 LPA (Expected)
Batch: 2018/ 19/ 20/ 21/ 22/ 23
Experience: 0 - 1 (Years)
Location: Work From Home
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
👍12❤2👏2😁2
🎯L&T-Technology Recruitment 2023 Details
Program Name Trainee Engineer
Qualification B.E/B.Tech
Batch Any Batch
Experience Freshers
CTC 4 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Program Name Trainee Engineer
Qualification B.E/B.Tech
Batch Any Batch
Experience Freshers
CTC 4 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
👍11❤4👏3
🎯 HCL Technologies Recruitment 2023 : Hiring for Freshers as Trainee
Job Role Trainee
Education B.E / B.Tech
Batches 2020/2021/2022
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
Job Role Trainee
Education B.E / B.Tech
Batches 2020/2021/2022
CTC/Salary 4.2 LPA
Apply Now:- http://www.allcoding1.com
Telegram:- @allcoding1
👍18😁5❤3👏1