#include<iostream>\n#include<algorithm>\n#include<vector>\n#include<cstdio>\n#include<cmath>\n#include<cstring>\nusing namespace std;\ntypedef long long ll;\nconst int P=998244353;\nint a,b,k;\nint ans=1;\nint main(void){\n cin>>a>>b>>k;\n for(int i=1;i<=k;i++){\n if(i%a==0) ans=(ans*2)%P;\n if(i%b==0){\n ans=(ans+1)/2;\n ans%=P;\n }\n }\n cout<<ans<<endl;\n return 0;\n}

C++ 细胞分裂问题:优化代码,快速求解模运算

原文地址: http://www.cveoy.top/t/topic/qvbG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录