15,898,987 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by NISHANK BABU (Top 6 by date)
NISHANK BABU
26-May-21 3:40am
View
i didn't get u..
NISHANK BABU
26-May-21 3:26am
View
#include <stdio.h>
#define min(x,y) (x <= y ? x : y)
#define max(x,y) (x <= y ? x : y)
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
int n, a, b;
scanf("%d%d%d",&n,&a,&b);
int x = min(a, b);
int y = max(a, b);
int ans = n;
for (int i = x; i < y; i++)
{
int temp = max((i - 1) + min(x - 1, i - x), (n - i - 1) + min(n - y, y - i - 1));
ans = min(ans, temp);
}
printf(ans,"\n");
}
}
error
timeout: the monitored command dumped core
NISHANK BABU
26-May-21 3:25am
View
Deleted
#include <stdio.h>
#define min(x,y) (x <= y ? x : y)
#define max(x,y) (x <= y ? x : y)
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
int n, a, b;
scanf("%d%d",&n,&a,&b);
int x = min(a, b);
int y = max(a, b);
int ans = n;
for (int i = x; i < y; i++)
{
int temp = max((i - 1) + min(x - 1, i - x), (n - i - 1) + min(n - y, y - i - 1));
ans = min(ans, temp);
}
printf(ans,"\n");
}
}
error
timeout: the monitored command dumped core
NISHANK BABU
9-May-21 12:04pm
View
Deleted
It's working thank you soo much
NISHANK BABU
9-May-21 0:33am
View
Deleted
I had given the inputs as
3
0709
1337
246432
Correct output is
0079
1337
234642
What I got is
0
0079
234642
Can u say me ur logic for this..plz
NISHANK BABU
7-May-21 12:08pm
View
Deleted
can u do it for me if possible...
Show More