提交时间:2024-08-20 11:38:53

运行 ID: 168622

#include <iostream> #include <cstdio> #include <string> using namespace std; int main() { int n; cin>>n; int n1=1; for (int i = 0; i < n; i++){ n1*=10; } if(n==1) n1=9; int ans=0; for (int i = n1/10; i < n1; i++){ int g=0; int i1=i; while(i1>=3&&i%3==0){ g++; i1/=3; } if(g%2==0) ans++; } cout<<ans<<endl; return 0; } /* int i1=i,g=0; while(i1!=0) { if(i1%10==3) g++; i1/=10; } if(g%2==0) ans++; */