#include<iostream> #include<cmath> #include<cstdio> #include <string> using namespace std; //int days(int m) { // /*int d1, d2, d3; // d1 = 0; // d2 = 0; // d3 = 0; // if (m == 0) // return 287; // else if (m == 9) // return 294; // else { // for (int i = 1; i <= 28; i++) { // if (m - i % 10 != 1 && m - i % 10 != -1) { // d1++; // } // } // for (int i = 1; i <= 30; i++) { // if (m - i % 10 != 1 && m - i % 10 != -1) { // d2++; // } // } // for (int i = 1; i <= 31; i++) { // if (m - i % 10 != 1 && m - i % 10 != -1) { // d3++; // } // } // int d; // d = d1 + 4 * d2 + 7 * d3;*/ // //cout << d1 <<" "<< d2<<" " << d3; // // return a[m]; // //} int main() { int n; char data[100]; cin >> n; int a[11] = { 287,294,286,293,293,293,293,293,294,294 }; for (int i = 0; i < n; i++) { cin >> data; int m = strlen(data); cout << a(data[m-1] - '0'); } return 0; } /* Main.cc: In function 'int main()': Main.cc:48:22: error: 'strlen' was not declared in this scope int m = strlen(data); ^ Main.cc:49:28: error: 'a' cannot be used as a function cout << a(data[m-1] - '0'); ^ */ |
Double click to view unformatted code.