Wrong Answer
Code
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int len = s.size();
int m, c;
if(s[2]=='-'){
m = -(s[3]-'0');
}
else{
m = (s[2]-'0');
}
if(len>5){
c = s[len-1]-'0';
if(s[len-2]=='-'){
c = c * (-1);
}
}
else{
c = 0;
}
int q;
cin>>q;
while(q--){
getchar();
int x, y;
cin>>x>>y;
int res = (m*x + (c));
if(res==y){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1015 Friend in need is a friend indeed
- Contest
- Brain booster - 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2023-12-31 16:04:00
- Judged At
- 2024-11-11 03:45:18
- Judged By
- Score
- 30
- Total Time
- 4ms
- Peak Memory
- 324.0 KiB