View Code of Problem 8

#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n,j,k,num[10]={78,71,79,72,72,72,72,72,71,71};
	cin>>n;
	string s;
//	string *s=new string[n];
//尾号为0:1,9,11,19,21,29,31(135781012)—— 78
//尾号为1:2,10,12,20,22,30——71
//尾号为2:1,3,11,13,21,23,31——79
//……
	while(n--)
	{
		cin>>s;
		j=s.length()-1; 
		k=s[j]-'0';
		cout<<365-num[k]<<endl;
	}
	return 0;
 }

Double click to view unformatted code.


Back to problem 8