摘要: 水题~。 int main() { string s; cin>>s; sort(s.begin(),s.end(),greater<int>()); cout<<s<<' '; reverse(s.begin(),s.end()); int idx=0; while(s[0] == '0' && 阅读全文
posted @ 2021-04-05 22:46 Dazzling! 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 注意细节。 const int N=1010; char s[N]; int n; int main() { while(~scanf("%s",s)) { n=strlen(s); vector<int> res; int num=0; bool have=false; for(int i=0;i 阅读全文
posted @ 2021-04-05 21:04 Dazzling! 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 看到括号匹配当然想到栈了。 int main() { string s; while(cin>>s) { stack<char> stk; for(int i=0;i<s.size();i++) { if(s[i] == '(') stk.push(s[i]); else if(s[i] == ') 阅读全文
posted @ 2021-04-05 18:54 Dazzling! 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 打表,先把小于等于 N 的且与 7 无关的正整数找出来,然后再预处理出小于等于N的这些正整数平方和。 const int N=1e6+10; bool vis[N]; LL sum[N]; bool check(int x) { if(x % 7 == 0) return true; while(x 阅读全文
posted @ 2021-04-05 17:18 Dazzling! 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 打表,把所有$1$出现的位置存起来。 unordered_set<int> S; void init() { for(int i=1,d=1;i<=1e9;) { S.insert(i); i+=d; d++; } } int main() { init(); int T; cin>>T; whil 阅读全文
posted @ 2021-04-05 15:54 Dazzling! 阅读(27) 评论(0) 推荐(0) 编辑
摘要: \[ [F(n,1),F(n,2),F(n-1,1),F(n-1,2),F(n-2,1),F(n-2,2),1]=\\ [F(n-1,1),F(n-1,2),F(n-2,1),F(n-2,2),F(n-3,1),F(n-3,2),1] \begin{bmatrix} 0 & 1 & 1 & 0 & 阅读全文
posted @ 2021-04-05 12:31 Dazzling! 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Fibonacci数列:F(0)=1 , F(1)=1 , F(n)=F(n-1)+F(n-2) 我们以前快速求Fibonacci数列第n项的方法是:构造常系数矩阵 (一) Fibonacci数列f[n]=f[n-1]+f[n-2],f[1]=f[2]=1的第n项快速求法(不考虑高精度) 解法: 考 阅读全文
posted @ 2021-04-05 11:35 Dazzling! 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 裸题。 const int N=1e5+10; int a[N]; int n; int main() { cin>>n; for(int i=0;i<n;i++) cin>>a[i]; int res=0; int sum=0; for(int i=0;i<n;i++) { sum=max(sum 阅读全文
posted @ 2021-04-05 10:49 Dazzling! 阅读(62) 评论(0) 推荐(0) 编辑