Repository navigation
DevSphere foss easy problem solved - #10
manjeetsinghmeena wants to merge 6 commits into
Conversation
❌ Submission FailedOne or more checks in PR Checks did not pass. Fix the issues and push again to re-trigger grading. — DevSphere Bot |
There was a problem hiding this comment.
Pull request overview
This PR appears intended to finalize a working C++ solution for the “k-th positive integer not divisible by n” problem in this repository.
Changes:
- Added
#include<bits/stdc++.h>tosolution1.cpp. - Added an
else continue;inside the main counting loop. - Added a
.cph/*.probfile (local CP Helper/editor metadata).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| solution1.cpp | Small include/control-flow tweaks (but core algorithm remains O(k)). |
| .cph/.solution1.cpp_cb19fdfffcdc366cee572304652479c3.prob | Adds local editor metadata containing an absolute Windows path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| while (count < k) { | ||
| current++; | ||
| if (current % n != 0) count++; | ||
| else continue; |
There was a problem hiding this comment.
else continue; is redundant here because control flow would proceed to the next loop iteration anyway at the end of the while body. Removing it will make the loop clearer (and also makes it easier to refactor to an O(1) solution).
| else continue; |
| @@ -0,0 +1 @@ | |||
| {"name":"Local: solution1","url":"c:\\Users\\MANJEET\\OneDrive\\Desktop\\DEV-SPHERE\\DevSphere-FOSS-Easy\\solution1.cpp","tests":[{"id":1776171841784,"input":"4\n3 7\n4 12\n2 1\n10 26","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\MANJEET\\OneDrive\\Desktop\\DEV-SPHERE\\DevSphere-FOSS-Easy\\solution1.cpp","group":"local","local":true} No newline at end of file | |||
There was a problem hiding this comment.
This .cph/*.prob file appears to be a local editor/CPH artifact and includes an absolute Windows path with a username (c:\Users\MANJEET\...). This is machine-specific and can leak personal/local environment details; it should not be committed. Consider removing it from the repo and adding .cph/ to .gitignore to prevent reintroducing it.
| {"name":"Local: solution1","url":"c:\\Users\\MANJEET\\OneDrive\\Desktop\\DEV-SPHERE\\DevSphere-FOSS-Easy\\solution1.cpp","tests":[{"id":1776171841784,"input":"4\n3 7\n4 12\n2 1\n10 26","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\MANJEET\\OneDrive\\Desktop\\DEV-SPHERE\\DevSphere-FOSS-Easy\\solution1.cpp","group":"local","local":true} | |
| {"name":"Local: solution1","url":"solution1.cpp","tests":[{"id":1776171841784,"input":"4\n3 7\n4 12\n2 1\n10 26","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"solution1.cpp","group":"local","local":true} |
| @@ -10,6 +11,7 @@ int main() { | |||
| while (count < k) { | |||
| current++; | |||
| if (current % n != 0) count++; | |||
| else continue; | |||
| } | |||
There was a problem hiding this comment.
The main loop is O(k) (incrementing current until count == k), which will not finish for the problem constraints (k up to 1e15) and will TLE on the provided samples/in_sample.txt (k is ~1e14-1e15). Consider replacing the loop with the O(1) formula for the k-th positive integer not divisible by n (commonly ans = k + (k - 1) / (n - 1) for n>1).
| @@ -1,3 +1,4 @@ | |||
| #include<bits/stdc++.h> | |||
There was a problem hiding this comment.
#include<bits/stdc++.h> is a GCC-specific header and is non-standard; it can break portability outside g++. Since the test runner already compiles with -std=c++17, it’s better to include only the standard headers you use (e.g., <iostream>). Also, including both bits/stdc++.h and <iostream> is redundant.
| #include<bits/stdc++.h> |
❌ Submission FailedOne or more checks in PR Checks did not pass. Fix the issues and push again to re-trigger grading. — DevSphere Bot |
❌ Submission FailedOne or more checks in PR Checks did not pass. Fix the issues and push again to re-trigger grading. — DevSphere Bot |
❌ Submission FailedOne or more checks in PR Checks did not pass. Fix the issues and push again to re-trigger grading. — DevSphere Bot |
❌ Submission FailedOne or more checks in PR Checks did not pass. Fix the issues and push again to re-trigger grading. — DevSphere Bot |
✅ Submission Accepted!All checks passed and your score has been recorded on the
— DevSphere Bot |
No description provided.