View Code of Problem 8

#include <iostream>
#include <cstring>
using namespace std;
int main(void){
	int n;
	char c[12]={0};
	cin>>n;
	while(n--){
		cin>>c;
		int len=strlen(c)-1;
		if(c[len]=='9'||c[len]=='1'||c[len]=='8')
			cout<<"294";
		else if(c[len]>='3'&&c[len]<='7') 
			cout<<"293";
		else if(c[len]=='0')
			cout<<"287";
		else
			cout<<"286";
		cout<<endl; 
	}
}

Double click to view unformatted code.


Back to problem 8