Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include <fstream>
#include <sstream>
int main(){
std::ifstream inputFile; inputFile.open("input.txt");
int T; inputFile >> T;
FILE * outputFile = fopen("output.txt","w");
while(T--){
long n; inputFile >> n;
fputs((n % 2) ? "0\n" : "1\n", outputFile);
}
inputFile.close();
fclose(outputFile);
return 0;
}
Copy The Code &
Try With Live Editor
Input
2
2
1
2
1
Output
1
0
Demonstration
Codeforces Solution-E. Put Knight!-Solution in C, C++, Java, Python