#include<algorithm> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; int main(){ //ios::sync_with_stdio(0); //cin.tie(0);cout.tie(0); int times; int day[12]={31,28,31,30,31,30,31,31,30,31,30,31}; cin>>times; while(times--) { string a; int tem=0; cin>>a; int len=a.length(); int num=a[len-1]-'0'; //cout<<num<<endl; for(int i=0;i<12;i++) { for(int j=1;j<=day[i];j++) if((j-1)%10==num||(j+1)%10==num) tem++; } cout<<365-tem<<endl; if(times>=1) cout<<endl; } return 0; } /* Main.cc: In function 'int main()': Main.cc:11:5: error: 'cin' was not declared in this scope cin>>times; ^~~ Main.cc:11:5: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'? Main.cc:5:1: +#include <iostream> using namespace std; Main.cc:11:5: cin>>times; ^~~ Main.cc:14:9: error: 'string' was not declared in this scope string a; ^~~~~~ Main.cc:14:9: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'? Main.cc:5:1: +#include <string> using namespace std; Main.cc:14:9: string a; ^~~~~~ Main.cc:16:14: error: 'a' was not declared in this scope cin>>a; ^ Main.cc:26:9: error: 'cout' was not declared in this scope cout<<365-tem<<endl; ^~~~ Main.cc:26:9: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'? Main.cc:26:24: error: 'endl' was not declared in this scope cout<<365-tem<<endl; ^~~~ Main.cc:26:24: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'? Main.cc:5:1: +#include <ostream> using namespace std; Main.cc:26:24: cout<<365-tem<<endl; ^~~~ */ |
Double click to view unformatted code.