102 条题解
-
1
终于可以写一份A+B
这么难的题的题解了。咦?竟然没有人写LCT的题解?
Link-Cut Tree 会很伤心的!
ORZ为了不让LCT伤心于是我来一份LCT的A+B题解吧!
送上代码:`
#include <cstring> #include <cstdio> #include <cstring> using namespace std; struct node { int data,rev,sum; node *son[2],*pre; bool judge(); bool isroot(); void pushdown(); void update(); void setson(node *child,int lr); }lct[233]; int top,a,b; node *getnew(int x) { node *now=lct+ ++top; now->data=x; now->pre=now->son[1]=now->son[0]=lct; now->sum=0; now->rev=0; return now; } bool node::judge(){return pre->son[1]==this;} bool node::isroot() { if(pre==lct)return true; return !(pre->son[1]==this||pre->son[0]==this); } void node::pushdown() { if(this==lct||!rev)return; swap(son[0],son[1]); son[0]->rev^=1; son[1]->rev^=1; rev=0; } void node::update(){sum=son[1]->sum+son[0]->sum+data;} void node::setson(node *child,int lr) { this->pushdown(); child->pre=this; son[lr]=child; this->update(); } void rotate(node *now) { node *father=now->pre,*grandfa=father->pre; if(!father->isroot()) grandfa->pushdown(); father->pushdown();now->pushdown(); int lr=now->judge(); father->setson(now->son[lr^1],lr); if(father->isroot()) now->pre=grandfa; else grandfa->setson(now,father->judge()); now->setson(father,lr^1); father->update();now->update(); if(grandfa!=lct) grandfa->update(); } void splay(node *now) { if(now->isroot())return; for(;!now->isroot();rotate(now)) if(!now->pre->isroot()) now->judge()==now->pre->judge()?rotate(now->pre):rotate(now); } node *access(node *now) { node *last=lct; for(;now!=lct;last=now,now=now->pre) { splay(now); now->setson(last,1); } return last; } void changeroot(node *now) { access(now)->rev^=1; splay(now); } void connect(node *x,node *y) { changeroot(x); x->pre=y; access(x); } void cut(node *x,node *y) { changeroot(x); access(y); splay(x); x->pushdown(); x->son[1]=y->pre=lct; x->update(); } int query(node *x,node *y) { changeroot(x); node *now=access(y); return now->sum; } int main() { scanf("%d%d",&a,&b); node *A=getnew(a); node *B=getnew(b); //连边 Link connect(A,B); //断边 Cut cut(A,B); //再连边orz Link again connect(A,B); printf("%d\n",query(A,B)); return 0; } -
-1
贴下高精度
#include<bits/stdc++.h> using namespace std; int myCompare(string a,string b) { if(a.size()!=b.size()) { if(a.size()>b.size()) return 1; else return -1; } else { if(a>b) return 1; else if(a==b) return 0; else return -1; } } string myAdd(string a,string b) { int n=max(a.size(),b.size())+1; vector<int>ans(n,0); int i=a.size()-1,j=b.size()-1,k=n-1; while(i>=0&&j>=0) { ans[k--]=(a[i--]-'0')+(b[j--]-'0'); } while(j>=0) { ans[k--]=(b[j--]-'0'); } while(i>=0) { ans[k--]=(a[i--]-'0'); } string c=""; for(int i=n-1;i>0;i--) { if(ans[i]>=10) { ans[i]-=10; ans[i-1]++; } c.insert(0,1,ans[i]+'0'); } if(ans[0]>0) { c.insert(0,1,ans[0]+'0'); } return c; } int main(){ string a,b; cin>>a>>b; cout<<myAdd(a,b); return 0; } -
-1
[ ] 54 道题
- 1
状态 题目显示标签 AC / 尝试 难度[](javascript:;) -------------------------------------------------------- - 1
[ 进入编辑模式](javascript:;)
分类
根据当前过滤条件随机选择一道题
状态
开发
支持
-
Language
-
主题
-
Worker 0 in 23ms
-
Powered by Hydro v4.7.2 Community
-
-1
1. [](http://219.153.61.2:20004/) 1. [首页](http://219.153.61.2:20004/) 1. [题库](http://219.153.61.2:20004/p) 1. [训练](http://219.153.61.2:20004/training) 1. [比赛](http://219.153.61.2:20004/contest) 1. [作业](http://219.153.61.2:20004/homework) 1. [评测记录](http://219.153.61.2:20004/record?uidOrName=192) 1. [排名](http://219.153.61.2:20004/ranking) 1. [202522249 ](http://219.153.61.2:20004/user/192) [ ] 54 道题 * **1** | 状态 | 题目**显示标签** | AC / 尝试 | 难度[](javascript:;) | | - | - | - | - | | -------------------------------------------------------- | | [100 Accepted](http://219.153.61.2:20004/record/636cde756248fb90a93b86c3) | [**P7**【入门】鸡兔同笼问题](http://219.153.61.2:20004/p/7)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 43 / 100 | 4 | | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ------ | | [100 Accepted](http://219.153.61.2:20004/record/636cde8e6248fb90a93b86d1) | [**P8**【入门】买小猫小狗](http://219.153.61.2:20004/p/8)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 27 / 51 | 3 | | [100 Accepted](http://219.153.61.2:20004/record/636ce3b66248fb90a93b87a9) | [**P15**【入门】百钱百鸡问题](http://219.153.61.2:20004/p/15)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 40 / 147 | 6 | | [100 Accepted](http://219.153.61.2:20004/record/6370ea546248fb90a93bde04) | [**P17**【入门】购买文具](http://219.153.61.2:20004/p/17)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 16 / 25 | 4 | | [100 Accepted](http://219.153.61.2:20004/record/6370ebbb6248fb90a93bde39) | [**P18**【入门】兑换硬币](http://219.153.61.2:20004/p/18)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 20 / 59 | 6 | | [100 Accepted](http://219.153.61.2:20004/record/6374862d6248fb90a93c3006) | [**P75**【基础】小青蛙回来了](http://219.153.61.2:20004/p/75)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 15 / 26 | 5 | | [100 Accepted](http://219.153.61.2:20004/record/6374873d6248fb90a93c30a6) | [**P76**【基础】寻找2的幂](http://219.153.61.2:20004/p/76)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 12 / 17 | 6 | | [100 Accepted](http://219.153.61.2:20004/record/637487736248fb90a93c30ca) | [**P77**【入门】桐桐的计算](http://219.153.61.2:20004/p/77)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 8 / 20 | 7 | | [100 Accepted](http://219.153.61.2:20004/record/637488036248fb90a93c30f2) | [**P78**【入门】桐桐去购物](http://219.153.61.2:20004/p/78)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 6 / 21 | 8 | | [100 Accepted](http://219.153.61.2:20004/record/637489056248fb90a93c317b) | [**P79**【入门】求恰好使s=1+1/2+1/3+…+1/n的值大于X时n的值。](http://219.153.61.2:20004/p/79)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 9 / 10 | 9 | | [100 Accepted](http://219.153.61.2:20004/record/63748ce36248fb90a93c31a1) | [**P80**【基础】三角形的个数](http://219.153.61.2:20004/p/80)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 8 / 16 | 8 | | [100 Accepted](http://219.153.61.2:20004/record/63748d1c6248fb90a93c31bc) | [**P82**【入门】时间转换](http://219.153.61.2:20004/p/82)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 9 / 19 | 7 | | [100 Accepted](http://219.153.61.2:20004/record/63748d406248fb90a93c31c9) | [**P83**【入门】猴子吃桃子](http://219.153.61.2:20004/p/83)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 32 / 90 | 5 | | [100 Accepted](http://219.153.61.2:20004/record/63748e116248fb90a93c31d5) | [**P84**【基础】回文数](http://219.153.61.2:20004/p/84)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 9 / 16 | 7 | | [100 Accepted](http://219.153.61.2:20004/record/63749bdc6248fb90a93c3360) | [**P85**【入门】因子求和](http://219.153.61.2:20004/p/85)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 5 / 18 | 8 | | [100 Accepted](http://219.153.61.2:20004/record/63749c216248fb90a93c336f) | [**P86**【入门】寻找雷劈数](http://219.153.61.2:20004/p/86)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 6 / 12 | 9 | | [100 Accepted](http://219.153.61.2:20004/record/63749c3f6248fb90a93c337b) | [**P87**【入门】姐妹数对](http://219.153.61.2:20004/p/87)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 6 / 8 | 9 | | [100 Accepted](http://219.153.61.2:20004/record/63749cf56248fb90a93c3387) | [**P88**【入门】两个自然数M和N的最小公倍数。](http://219.153.61.2:20004/p/88)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 11 / 15 | 6 | | [100 Accepted](http://219.153.61.2:20004/record/63749e566248fb90a93c33a8) | [**P89**【入门】求两个自然数M和N的最大公约数](http://219.153.61.2:20004/p/89)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 14 / 16 | 6 | | [100 Accepted](http://219.153.61.2:20004/record/63749f3d6248fb90a93c33b6) | [**P90**【入门】找数游戏](http://219.153.61.2:20004/p/90)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 4 / 11 | 9 | | [100 Accepted](http://219.153.61.2:20004/record/63749f946248fb90a93c33c2) | [**P91**【入门】同因查找](http://219.153.61.2:20004/p/91)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 7 / 8 | 9 | | [0 Format Error](http://219.153.61.2:20004/record/6374a0b36248fb90a93c33d0) | [**P92**【入门】奇数及偶数和](http://219.153.61.2:20004/p/92)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 0 / 8 | 10 | | [100 Accepted](http://219.153.61.2:20004/record/6374a31a6248fb90a93c33eb) | [**P93**【入门】aabb](http://219.153.61.2:20004/p/93)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 14 / 22 | 5 | | [100 Accepted](http://219.153.61.2:20004/record/637588826248fb90a93c40e2) | [**P121**【基础】“倒”数](http://219.153.61.2:20004/p/121)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 47 / 240 | 7 | | [100 Accepted](http://219.153.61.2:20004/record/638576e16248fb90a93d791b) | [**P220**【入门】买糕点](http://219.153.61.2:20004/p/220)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 2 | 10 | | [100 Accepted](http://219.153.61.2:20004/record/638577136248fb90a93d7927) | [**P227**【入门】阿凡提的难题](http://219.153.61.2:20004/p/227)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 3 / 6 | 10 | | [100 Accepted](http://219.153.61.2:20004/record/635cdfc26248fb90a939b599) | [**P241**【入门】角谷猜想](http://219.153.61.2:20004/p/241)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 5 / 24 | 8 | | [100 Accepted](http://219.153.61.2:20004/record/6397c2fd6248fb90a93eb064) | [**P248**【入门】求数列的第n项的值是多少?](http://219.153.61.2:20004/p/248)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 2 | 10 | | [100 Accepted](http://219.153.61.2:20004/record/6397c32b6248fb90a93eb070) | [**P249**【入门】搬砖问题](http://219.153.61.2:20004/p/249)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 3 / 11 | 9 | | [100 Accepted](http://219.153.61.2:20004/record/6397c4cc6248fb90a93eb07d) | [**P250**【入门】马克思手稿的问题](http://219.153.61.2:20004/p/250)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 3 / 7 | 10 | | | [**P261**【入门】该存多少钱](http://219.153.61.2:20004/p/261)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 0 / 3 | 10 | | | [**P310**【基础】第n盆花是什么颜色?](http://219.153.61.2:20004/p/310)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 14 / 112 | 8 | | | [**P315**【入门】队形数量求解](http://219.153.61.2:20004/p/315)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 4 | 10 | | | [**P329**【入门】需要举办多少场足球赛?](http://219.153.61.2:20004/p/329)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 4 / 6 | 10 | | | [**P339**【入门】怎样种树?](http://219.153.61.2:20004/p/339)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P346**【入门】植树的人数](http://219.153.61.2:20004/p/346)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 5 / 10 | 9 | | | [**P347**【入门】纸盒的最大体积是多少?](http://219.153.61.2:20004/p/347)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 4 | 10 | | | [**P348**【入门】买公园门票](http://219.153.61.2:20004/p/348)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P349**【入门】费马定理](http://219.153.61.2:20004/p/349)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 3 | 10 | | | [**P352**【入门】门票的定价](http://219.153.61.2:20004/p/352)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | [100 Accepted](http://219.153.61.2:20004/record/63771c536248fb90a93c78bb) | [**P353**【入门】小兔子的最大活动面积](http://219.153.61.2:20004/p/353)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 6 | 10 | | | [**P391**【入门】恐龙园买玩具?](http://219.153.61.2:20004/p/391)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P392**【入门】小丽找数?](http://219.153.61.2:20004/p/392)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P393**【入门】开学大采购?](http://219.153.61.2:20004/p/393)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P457**【入门】小明学游泳](http://219.153.61.2:20004/p/457)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P465**【基础】小鱼的航程](http://219.153.61.2:20004/p/465)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 2 | 10 | | | [**P466**【基础】数的统计](http://219.153.61.2:20004/p/466)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P788**【入门】换钞票](http://219.153.61.2:20004/p/788)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P789**【入门】采购水果](http://219.153.61.2:20004/p/789)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 2 | 10 | | | [**P957**【入门】数字之和](http://219.153.61.2:20004/p/957)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 3 | 10 | | | [**P1122**【入门】换钞票(2)(change)](http://219.153.61.2:20004/p/1122)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 0 / 0 | (无) | | | [**P1124**【入门】换零钱(1)](http://219.153.61.2:20004/p/1124)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 1 / 1 | 10 | | | [**P1128**【入门】找公约数](http://219.153.61.2:20004/p/1128)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 29 / 149 | 7 | | | [**P1129**【入门】求约数](http://219.153.61.2:20004/p/1129)* [需要找规律的循环](http://219.153.61.2:20004/p?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) | 2 / 2 | 10 | * **1** [ 进入编辑模式](javascript:;) # 分类 * [动态规划](http://219.153.61.2:20004/p?q=category%3A%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92) * [搜索](http://219.153.61.2:20004/p?q=category%3A%E6%90%9C%E7%B4%A2) * [分治](http://219.153.61.2:20004/p?q=category%3A%E5%88%86%E6%B2%BB) * [计算几何](http://219.153.61.2:20004/p?q=category%3A%E8%AE%A1%E7%AE%97%E5%87%A0%E4%BD%95) * [贪心](http://219.153.61.2:20004/p?q=category%3A%E8%B4%AA%E5%BF%83) * [树结构](http://219.153.61.2:20004/p?q=category%3A%E6%A0%91%E7%BB%93%E6%9E%84) * [图结构](http://219.153.61.2:20004/p?q=category%3A%E5%9B%BE%E7%BB%93%E6%9E%84) * [数论](http://219.153.61.2:20004/p?q=category%3A%E6%95%B0%E8%AE%BA) * [模拟](http://219.153.61.2:20004/p?q=category%3A%E6%A8%A1%E6%8B%9F) * [数据结构](http://219.153.61.2:20004/p?q=category%3A%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84) * [博弈论](http://219.153.61.2:20004/p?q=category%3A%E5%8D%9A%E5%BC%88%E8%AE%BA) * [字符串](http://219.153.61.2:20004/p?q=category%3A%E5%AD%97%E7%AC%A6%E4%B8%B2) * [组合数学](http://219.153.61.2:20004/p?q=category%3A%E7%BB%84%E5%90%88%E6%95%B0%E5%AD%A6) * [线性代数](http://219.153.61.2:20004/p?q=category%3A%E7%BA%BF%E6%80%A7%E4%BB%A3%E6%95%B0) * [高精度算法](http://219.153.61.2:20004/p?q=category%3A%E9%AB%98%E7%B2%BE%E5%BA%A6%E7%AE%97%E6%B3%95) * [递推](http://219.153.61.2:20004/p?q=category%3A%E9%80%92%E6%8E%A8) * [递归](http://219.153.61.2:20004/p?q=category%3A%E9%80%92%E5%BD%92) * [概率论](http://219.153.61.2:20004/p?q=category%3A%E6%A6%82%E7%8E%87%E8%AE%BA) * [NPC](http://219.153.61.2:20004/p?q=category%3ANPC) * [其他](http://219.153.61.2:20004/p?q=category%3A%E5%85%B6%E4%BB%96) [ 手气不错](http://219.153.61.2:20004/problem/random?q=category%3A%E9%9C%80%E8%A6%81%E6%89%BE%E8%A7%84%E5%BE%8B%E7%9A%84%E5%BE%AA%E7%8E%AF) 根据当前过滤条件随机选择一道题 # 状态 * [评测队列](http://219.153.61.2:20004/record) * [服务状态](http://219.153.61.2:20004/status) # 开发 * [开源](https://github.com/hydro-dev/Hydro) * [API](http://219.153.61.2:20004/api) # 支持 * [帮助](http://219.153.61.2:20004/wiki/help) * [QQ 群](http://219.153.61.2:20004/wiki/about#contact) 1. [关于](http://219.153.61.2:20004/wiki/about) 1. [联系我们](http://219.153.61.2:20004/wiki/about#contact) 1. [隐私](http://219.153.61.2:20004/wiki/about#privacy) 1. [服务条款](http://219.153.61.2:20004/wiki/about#tos) 1. [版权申诉](https://hydro.js.org/#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC) 1. Language 1. [Legacy mode](http://219.153.61.2:20004/legacy?legacy=true) 1. 主题 1. 1. 1. Worker 0 in 23ms 1. Powered by [Hydro v4.7.2](https://hydro.js.org/) Community -
-1
#include<bits/stdc++.h> using namespace std; struct zzh{ char xm[100]; int xb; int n; int y; int r; }; zzh a[1000]; bool hzz(zzh f,zzh g) { if(f.n>g.n) { return 0; } if(f.n==g.n) { if(f.y>g.y) { return 0; } if(f.y==g.y) { if(f.r>g.r) { return 1; } } return 1; } return 1; } int main() { cout<<"请输入一共有多少人"<<endl; int n; cin>>n; cout<<"输入每个人的 姓名 出生年份 出生月份 出生日"<<endl; for(int i=1;i<=n;i++){ cout<<"第"<<i<<"个人:"; cin>>a[i].xm>>a[i].n>>a[i].y>>a[i].r; } sort(a+1,a+n+1,hzz); cout<<endl; for(int i=1;i<=n;i++) { cout<<"第"<<i<<"大的:"; cout<<a[i].xm<<" "<<a[i].n<<" "<<a[i].y<<" "<<a[i].r<<endl; } return 0; } -
-1题解 - 【入门】大小写转换 - Hydro body { --font-family: "Microsoft Yahei", "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans"; --code-font-family: "Ubuntu Mono", "monaco", "Source Code Pro", "Consolas", "Lucida Console", "monospace"; --font-ligatures: none !important; } #panel { display: flex; flex-direction: column; }
3 条题解
-
0</li>
6 (tyz) LV 5
</span></div> </div> <div class="hasjs--hide"> <form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel"> <div> <textarea name="content" class="textbox" data-markdown required></textarea> </div> <div> <input type="submit" class="rounded primary button dczcomments__box__submit" value="分享 (Ctrl+Enter)" data-value-reply="回复 (Ctrl+Enter)" data-value-comment="分享 (Ctrl+Enter)" data-value-comment-update="更新 (Ctrl+Enter)" data-value-reply-update="更新 (Ctrl+Enter)"> <input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="取消 (Esc)"> </div> <input type="hidden" name="operation" value="submit"> </form> </div> <div class="nojs--hide"> <textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{"operation":"submit"}" placeholder="发表您的题解"></textarea> </div> <div class="commentbox-placeholder"></div> <ul style="display:none"> <li class="dczcomments__reply commentbox-container"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a></div> </div> <div class="commentbox-placeholder"></div> </div> </div> </li> </ul> </div>1题解 - 【入门】大小写转换 - Hydro body { --font-family: "Microsoft Yahei", "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans"; --code-font-family: "Ubuntu Mono", "monaco", "Source Code Pro", "Consolas", "Lucida Console", "monospace"; --font-ligatures: none !important; } #panel { display: flex; flex-direction: column; }</li>#include<bits/stdc++.h> using namespace std; int main(){ char a; cin>>a; int v; v=int(a); a=a+32; printf("%c",a); return 0; }</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div>1汤涵棋 (202420502) LV 4 @ 2022-10-29 8:03:06
鸡
</span> @ 2023-2-18 2:05:22</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a>盗我号是吧
</span> @ 2023-2-18 2:05:39</div> <div class="commentbox-edit-target"></div> </div> </div> </li> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a>可能还不够资格哈哈哈哈哈
</div> <div class="commentbox-edit-target"></div> </div> </div> </li></ul> </div>0</li></ul>给个全对的题解
</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div><ul class="pager pager-bottom"><li> <span class="pager__item current">1</span> </li></ul> </div> </div> </div>3 条题解
-
0</li>
6 (tyz) LV 5
</span></div> </div> <div class="hasjs--hide"> <form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel"> <div> <textarea name="content" class="textbox" data-markdown required></textarea> </div> <div> <input type="submit" class="rounded primary button dczcomments__box__submit" value="分享 (Ctrl+Enter)" data-value-reply="回复 (Ctrl+Enter)" data-value-comment="分享 (Ctrl+Enter)" data-value-comment-update="更新 (Ctrl+Enter)" data-value-reply-update="更新 (Ctrl+Enter)"> <input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="取消 (Esc)"> </div> <input type="hidden" name="operation" value="submit"> </form> </div> <div class="nojs--hide"> <textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{"operation":"submit"}" placeholder="发表您的题解"></textarea> </div> <div class="commentbox-placeholder"></div> <ul style="display:none"> <li class="dczcomments__reply commentbox-container"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a></div> </div> <div class="commentbox-placeholder"></div> </div> </div> </li> </ul> </div>1</li>#include<bits/stdc++.h> using namespace std; int main(){ char a; cin>>a; int v; v=int(a); a=a+32; printf("%c",a); return 0; }</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div>1汤涵棋 (202420502) LV 4 @ 2022-10-29 8:03:06
鸡
</span> @ 2023-2-18 2:05:22</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a>盗我号是吧
</span> @ 2023-2-18 2:05:39</div> <div class="commentbox-edit-target"></div> </div> </div> </li> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a>可能还不够资格哈哈哈哈哈
</div> <div class="commentbox-edit-target"></div> </div> </div> </li></ul> </div>0</li></ul>给个全对的题解
</div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div><ul class="pager pager-bottom"><li> <span class="pager__item current">1</span> </li></ul> </div> </div> </div>
-
-
-2
#include<bits/stdc++.h> using namespace std; char a[200]; int main(){ int len,lenmax=0,t=0,end=0,k=0;//len:a的长;lenmax:最长单词长;t:当前单词长;end:词的结束索引 ;k:词的开始索引 gets(a);//输入字符数组a len = strlen(a);//获取a的长 for(int i=0;i<len;i++){//遍历a数组 if(a[i]!=' ' && a[i]!='.'){//如果不是空格或句号 t++;//那么当前单词长++ } else{//如果是空格或句号 if(t>lenmax){//判断当前单词长 > 最长单词长 lenmax = t;//将当前单词长赋值给最长单词长 k = i-t;//记录下该单词的起始位置 end=i-1; } t=0; } } for(int i=k;i<=end;i++){ cout<<a[i]; } cout<<" "<<lenmax; return 0; }
-
-2
<!DOCTYPE html> <html data-page="problem_solution" data-layout="basic" class="layout--basic page--problem_solution theme--dark nojs" lang="zh" data-app="Hydro"> <head> <meta charset="UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="chrome=1"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"> <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192"> <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"> <link rel="canonical" href="/p/968/solution"> <meta name="theme-color" content="#56758f"> <meta property="og:site_name" content="Hydro" /> <meta property="og:title" content="题解 - 【入门】大小写转换 - Hydro" /> <meta property="og:url" content="/p/968/solution" /> <meta property="og:image" content="/favicon-96x96.png" /> <title>题解 - 【入门】大小写转换 - Hydro</title> <style> body { --font-family: "Microsoft Yahei", "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans"; --code-font-family: "Ubuntu Mono", "monaco", "Source Code Pro", "Consolas", "Lucida Console", "monospace"; --font-ligatures: none !important; } #panel { display: flex; flex-direction: column; } </style> <link rel="stylesheet" media="all" href="/theme-4.47.2.css"> <script> var _htmlNode = document.documentElement; _htmlNode.className = _htmlNode.className.replace(' nojs', ' hasjs'); try { import('data:text/javascript,');Object.fromEntries([]);window.matchMedia('all').addEventListener('change',()=>{}); } catch(e) { const s = document.createElement('script'); s.async = false; s.src = "/polyfill-4.47.2.js"; document.head.appendChild(s); } </script> </head> <body> <nav class="nav slideout-menu" id="menu"> <div class="row"><div class="columns clearfix"> <ol class="nav__list nav__list--main clearfix"> <li class="nav__list-item"> <a href="/"><img class="nav__logo" src="/components/navigation/nav-logo-small_dark.png"></a> </li> <li class="nav__list-item"> <a href="/" class="nav__item"> 首页 </a> </li> <li class="nav__list-item"> <a href="/p" class="nav__item nav--active"> 题库 </a> </li> <li class="nav__list-item"> <a href="/training" class="nav__item"> 训练 </a> </li> <li class="nav__list-item"> <a href="/contest" class="nav__item"> 比赛 </a> </li> <li class="nav__list-item"> <a href="/homework" class="nav__item"> 作业 </a> </li> <li class="nav__list-item"> <a href="/record?uidOrName=172" class="nav__item"> 评测记录 </a> </li> <li class="nav__list-item"> <a href="/ranking" class="nav__item"> 排名 </a> </li> </ol> <ol class="nav__list nav__list--secondary clearfix"> <li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-custom-class="nav__dropdown" data-dropdown-target="#menu-nav-user" data-dropdown-disabledconstrainToWindow data-dropdown-trigger-desktop-only> <a href="/user/172" class="nav__item">tyz <span class="icon icon-expand_more nojs--hide"></span></a> <ol class="dropdown-target menu" id="menu-nav-user"> <li class="menu__item"> <a href="/user/172" class="menu__link"> <span class="icon icon-account--circle"></span> 我的资料 </a> </li> <li class="menu__item"> <a href="/home/messages" class="menu__link"> <span class="icon icon-comment--multiple"></span> 站内消息 </a> </li> <li class="menu__seperator"></li> <li class="menu__item"> <a href="/home/settings/domain" class="menu__link"> <span class="icon icon-web"></span> @ Hydro </a> </li> <li class="menu__seperator"></li> <li class="menu__item"> <a href="/home/settings/account" class="menu__link"> <span class="icon icon-wrench"></span> 账户设置 </a> </li> <li class="menu__item"> <a href="/home/settings/preference" class="menu__link"> <span class="icon icon-sliders"></span> 偏好设置 </a> </li> <li class="menu__item"> <a href="/home/security" class="menu__link"> <span class="icon icon-security"></span> 安全设置 </a> </li> <li class="menu__seperator"></li> <li class="menu__item"> <a href="/home/domain" class="menu__link"> <span class="icon icon-web"></span> 我的域 </a> </li> <li class="menu__item"> <a href="/file" class="menu__link"> <span class="icon icon-file"></span> 我的文件 </a> </li> <li class="menu__item"> <a href="/blog/172" class="menu__link"> <span class="icon icon-book"></span> 博客 </a> </li> <li class="menu__seperator"></li> <li class="menu__item"> <a href="/logout" class="menu__link" name="nav_logout"> <span class="icon icon-logout"></span> 登出 </a> </li> </ol> </li> </ol> </div></div> </nav> <nav class="nav--shadow"></nav> <div class="slideout-panel" id="panel"> <div class="slideout-overlay"></div> <div class="header--mobile"> <div class="row"><div class="columns clearfix"> <div class="float-left"> <a class="header--mobile__domain" href="/" target="_self"> <img src="/components/navigation/nav-logo-small_dark.png"> </a> </div> <div class="float-right"> <button type="button" class="header__hamburger"> <div class="hamburger hamburger--spin"> <span class="hamburger-box"> <span class="hamburger-inner"></span> </span> </div> </button> </div> </div></div> </div> <div class="main"> <div class="row"> <div class="medium-9 columns"> <div class="section"> <div class="section__header"> <h1 class="section__title">3 条题解</h1> </div> <div class="section__body"> <ul class="dczcomments__list view--solution"> <li class="dczcomments__item"> <div class="media"> <div class="media__left top"> <div class="vote vote--discussion"> <div class="vote-number">0</div> </div> </div> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> <a class="user-profile-badge v-center badge--lv5" href="/user/172" data-tooltip="LV 5: Top 30%">LV 5</a> </span> </div> </div> <div class="hasjs--hide"> <form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel"> <div> <textarea name="content" class="textbox" data-markdown required></textarea> </div> <div> <input type="submit" class="rounded primary button dczcomments__box__submit" value="分享 (Ctrl+Enter)" data-value-reply="回复 (Ctrl+Enter)" data-value-comment="分享 (Ctrl+Enter)" data-value-comment-update="更新 (Ctrl+Enter)" data-value-reply-update="更新 (Ctrl+Enter)"> <input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="取消 (Esc)"> </div> <input type="hidden" name="operation" value="submit"> </form> </div> <div class="nojs--hide"> <textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{"operation":"submit"}" placeholder="发表您的题解"></textarea> </div> <div class="commentbox-placeholder"></div> <ul style="display:none"> <li class="dczcomments__reply commentbox-container"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> </span> </div> </div> <div class="commentbox-placeholder"></div> </div> </div> </li> </ul> </div> </div> </li> <li class="dczcomments__item"> <div class="media"> <div class="media__left top"> <div class="vote vote--discussion"> <div class="vote-number rotator--enabled">1</div> <form method="post" class="vote-op clearfix"> <input type="hidden" name="psid" value="63f0339bfe582d833fbeaa4c"> <button type="submit" name="operation" value="upvote" class="vote-button upvote active" data-tooltip="好评" data-tooltip-pos="bottom center" aria-label="好评"><span class="icon icon-vote--up"></span></button> <button type="submit" name="operation" value="downvote" class="vote-button downvote" data-tooltip="差评" data-tooltip-pos="bottom center" aria-label="差评"><span class="icon icon-vote--down"></span></button> </form> </div> </div> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> <a class="user-profile-badge v-center badge--lv5" href="/user/172" data-tooltip="LV 5: Top 30%">LV 5</a> </span> @ <span class="time relative" data-timestamp="1676686235">2023-2-18 2:10:35</span> </div> <div class="dczcomments__operations nojs--hide"> <a href="javascript:;" data-tooltip="复制链接" data-copylink="/p/968/solution/63f0339bfe582d833fbeaa4c"> <span class="icon icon-link"></span> </a> <a href="javascript:;" data-tooltip="回复" data-op="reply" data-type="comment" data-form="{"operation":"reply","psid":"63f0339bfe582d833fbeaa4c"}" ><span class="icon icon-reply"></span></a> <a href="javascript:;" data-tooltip="编辑" data-op="edit" data-type="comment" data-form="{"operation":"edit_solution","psid":"63f0339bfe582d833fbeaa4c"}" ><span class="icon icon-edit"></span></a> <a href="javascript:;" data-tooltip="删除" data-op="delete" data-type="comment" data-form="{"operation":"delete_solution","psid":"63f0339bfe582d833fbeaa4c"}" ><span class="icon icon-delete"></span></a> </div> </div> <div class="typo" data-emoji-enabled data-raw-url="/p/968/solution/63f0339bfe582d833fbeaa4c/raw"> <pre><code>#include<bits/stdc++.h> using namespace std; int main(){ char a; cin>>a; int v; v=int(a); a=a+32; printf("%c",a); return 0; } </code></pre> </div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div> </div> </li> <li class="dczcomments__item"> <div class="media"> <div class="media__left top"> <div class="vote vote--discussion"> <div class="vote-number rotator--enabled">1</div> <form method="post" class="vote-op clearfix"> <input type="hidden" name="psid" value="635cde3a6248fb90a939b2e6"> <button type="submit" name="operation" value="upvote" class="vote-button upvote active" data-tooltip="好评" data-tooltip-pos="bottom center" aria-label="好评"><span class="icon icon-vote--up"></span></button> <button type="submit" name="operation" value="downvote" class="vote-button downvote" data-tooltip="差评" data-tooltip-pos="bottom center" aria-label="差评"><span class="icon icon-vote--down"></span></button> </form> </div> </div> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//q1.qlogo.cn/g?b=qq&nk=510912216&s=160" width="20" height="20"> <a class="user-profile-name" href="/user/202"> 汤涵棋 (202420502) </a> <a class="user-profile-badge v-center badge--lv4" href="/user/202" data-tooltip="LV 4: Top 40%">LV 4</a> </span> @ <span class="time relative" data-timestamp="1667030586">2022-10-29 8:03:06</span> </div> <div class="dczcomments__operations nojs--hide"> <a href="javascript:;" data-tooltip="复制链接" data-copylink="/p/968/solution/635cde3a6248fb90a939b2e6"> <span class="icon icon-link"></span> </a> <a href="javascript:;" data-tooltip="回复" data-op="reply" data-type="comment" data-form="{"operation":"reply","psid":"635cde3a6248fb90a939b2e6"}" ><span class="icon icon-reply"></span></a> </div> </div> <div class="typo" data-emoji-enabled data-raw-url="/p/968/solution/635cde3a6248fb90a939b2e6/raw"> <p>鸡</p> </div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> </span> @ <span class="time relative" data-timestamp="1676685922">2023-2-18 2:05:22</span> </div> <div class="dczcomments__operations nojs--hide"> <a href="javascript:;" data-tooltip="回复" data-op="reply" data-type="reply"><span class="icon icon-reply"></span></a> </div> </div> <div class="typo" data-emoji-enabled data-raw-url="/p/968/solution/635cde3a6248fb90a939b2e6/63f03262fe582d833fbea99d/raw"> <p>盗我号是吧</p> </div> <div class="commentbox-edit-target"></div> </div> </div> </li> <li class="dczcomments__reply"> <div class="media"> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> </span> @ <span class="time relative" data-timestamp="1676685939">2023-2-18 2:05:39</span> </div> <div class="dczcomments__operations nojs--hide"> <a href="javascript:;" data-tooltip="回复" data-op="reply" data-type="reply"><span class="icon icon-reply"></span></a> </div> </div> <div class="typo" data-emoji-enabled data-raw-url="/p/968/solution/635cde3a6248fb90a939b2e6/63f03273fe582d833fbea99e/raw"> <p>可能还不够资格哈哈哈哈哈</p> </div> <div class="commentbox-edit-target"></div> </div> </div> </li></ul> </div> </div> </li> <li class="dczcomments__item"> <div class="media"> <div class="media__left top"> <div class="vote vote--discussion"> <div class="vote-number rotator--enabled">0</div> <form method="post" class="vote-op clearfix"> <input type="hidden" name="psid" value="63f0362cfe582d833fbeabeb"> <button type="submit" name="operation" value="upvote" class="vote-button upvote" data-tooltip="好评" data-tooltip-pos="bottom center" aria-label="好评"><span class="icon icon-vote--up"></span></button> <button type="submit" name="operation" value="downvote" class="vote-button downvote" data-tooltip="差评" data-tooltip-pos="bottom center" aria-label="差评"><span class="icon icon-vote--down"></span></button> </form> </div> </div> <div class="media__body top"> <div class="clearfix"> <div class="supplementary dczcomments__supplementary"> <span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=64" width="20" height="20"> <a class="user-profile-name" href="/user/172"> 6 (tyz) </a> <a class="user-profile-badge v-center badge--lv5" href="/user/172" data-tooltip="LV 5: Top 30%">LV 5</a> </span> @ <span class="time relative" data-timestamp="1676686892">2023-2-18 2:21:32</span> </div> <div class="dczcomments__operations nojs--hide"> <a href="javascript:;" data-tooltip="复制链接" data-copylink="/p/968/solution/63f0362cfe582d833fbeabeb"> <span class="icon icon-link"></span> </a> <a href="javascript:;" data-tooltip="回复" data-op="reply" data-type="comment" data-form="{"operation":"reply","psid":"63f0362cfe582d833fbeabeb"}" ><span class="icon icon-reply"></span></a> <a href="javascript:;" data-tooltip="编辑" data-op="edit" data-type="comment" data-form="{"operation":"edit_solution","psid":"63f0362cfe582d833fbeabeb"}" ><span class="icon icon-edit"></span></a> <a href="javascript:;" data-tooltip="删除" data-op="delete" data-type="comment" data-form="{"operation":"delete_solution","psid":"63f0362cfe582d833fbeabeb"}" ><span class="icon icon-delete"></span></a> </div> </div> <div class="typo" data-emoji-enabled data-raw-url="/p/968/solution/63f0362cfe582d833fbeabeb/raw"> <p>给个全对的题解</p> </div> <div class="commentbox-edit-target"></div> <ul class="dczcomments__replies commentbox-reply-target"></ul> </div> </div> </li></ul> <ul class="pager pager-bottom"><li> <span class="pager__item current">1</span> </li></ul> </div> </div> </div> <div class="medium-3 columns"> <div class="section side section--problem-sidebar"> <div class="section__header"> <h1 class="section__title">【入门】大小写转换</h1> </div> <div> <ol class="menu"> <li class="menu__item"><a class="menu__link" href="/p/968"> <span class="icon icon-flag"></span> 查看题目 </a></li> <li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/968/submit"> <span class="icon icon-send"></span> 递交 </a></li> <li class="menu__seperator"></li> <li class="menu__item"><a class="menu__link active" href="/p/968/solution"> <span class="icon icon-comment--text"></span> 题解 </a></li> <li class="menu__item"><a class="menu__link" href="/p/968/files"> <span class="icon icon-file"></span> 文件 </a></li> </ol> </div> </div> <div class="section side"> <div class="section__header"> <h1 class="section__title">信息</h1> </div> <div class="section__body typo" data-fragment-id="problem-sidebar-information"> <dl class="large horizontal"> <dt>ID</dt> <dd>968</dd> <dt>时间</dt> <dd>1000ms</dd> <dt>内存</dt> <dd>64MiB</dd> <dt>难度</dt> <dd>10</dd> <dt>标签</dt> <dd> <ul class="problem__tags"> <li class="problem__tag"><a class="problem__tag-link" href="/p?q=category%3A%E5%AD%97%E7%AC%A6%E5%9E%8B">字符型</a></li></ul> </dd> <dt>递交数</dt> <dd><a href="/record?pid=968">8</a></dd> <dt>已通过</dt> <dd>3</dd> <dt>上传者</dt> <dd><span class="user-profile-link"> <img class="small user-profile-avatar v-center" loading="lazy" src="//q1.qlogo.cn/g?b=qq&nk=14112085&s=160" width="20" height="20"> <a class="user-profile-name" href="/user/1"> mzh </a> </span> </dd> </dl> </div></div> </div> </div> </div> <div class="footer"> <div class="row"><div class="columns"> <div class="row footer__links"> <div class="medium-3 large-2 columns footer__category expandable"> <h1> 状态 <span class="expand-icon"> <span class="icon icon-expand_more"></span> </span> </h1> <div class="footer__category__expander"><ul class="footer__category__list"> <li class="footer__category__item"><a href="/record">评测队列</a></li> <li class="footer__category__item"><a href="/status">服务状态</a></li> </ul></div> </div> <div class="medium-3 large-2 columns footer__category expandable"> <h1> 开发 <span class="expand-icon"> <span class="icon icon-expand_more"></span> </span> </h1> <div class="footer__category__expander"><ul class="footer__category__list"> <li class="footer__category__item"><a href="https://github.com/hydro-dev/Hydro" target="_blank">开源</a></li> <li class="footer__category__item"><a href="/api">API</a></li> </ul></div> </div> <div class="medium-3 large-2 columns footer__category expandable end"> <h1> 支持 <span class="expand-icon"> <span class="icon icon-expand_more"></span> </span> </h1> <div class="footer__category__expander"><ul class="footer__category__list"> <li class="footer__category__item"><a href="/wiki/help">帮助</a></li> <!--<li class="footer__category__item"><a href="#">博客</a></li>--> <li class="footer__category__item"><a href="/wiki/about#contact">QQ 群</a></li> </ul></div> </div> </div> <div class="footer__extra-link clearfix"> <div class="footer__extra-left"> <ol class="clearfix"> <li class="footer__extra-link-item"><a href="/wiki/about">关于</a></li> <li class="footer__extra-link-item"><a href="/wiki/about#contact">联系我们</a></li> <li class="footer__extra-link-item"><a href="/wiki/about#privacy">隐私</a></li> <li class="footer__extra-link-item"><a href="/wiki/about#tos">服务条款</a></li> <li class="footer__extra-link-item"><a href="https://hydro.js.org/#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC">版权申诉</a></li> <li class="footer__extra-link-item nojs--hide" data-dropdown-target="#menu-footer-lang"> <span><span class="icon icon-global"></span> Language <span class="icon icon-expand_less"></span></span> <ol class="dropdown-target menu" id="menu-footer-lang"><li class="menu__item"><a class="menu__link" href="/language/en">English</a></li><li class="menu__item"><a class="menu__link" href="/language/ko">한국어</a></li><li class="menu__item"><a class="menu__link" href="/language/zh">简体中文</a></li><li class="menu__item"><a class="menu__link" href="/language/zh_TW">正體中文</a></li></ol> </li> <li class="footer__extra-link-item"> <a href="/legacy?legacy=true">Legacy mode</a> </li> <li class="footer__extra-link-item nojs--hide" data-dropdown-target="#menu-footer-theme"> <span><span class="icon icon-global"></span> 主题 <span class="icon icon-expand_less"></span></span> <ol class="dropdown-target menu" id="menu-footer-theme"> <li class="menu__item"><a class="menu__link" href="/set_theme/light">亮色</a></li> <li class="menu__item"><a class="menu__link" href="/set_theme/dark">暗色</a></li> </ol> </li> </ol> </div> <div class="footer__extra-right"> <ol class="clearfix"><li class="footer__extra-link-item"></li><li class="footer__extra-link-item"></li><li class="footer__extra-link-item">Worker 0 in 13ms</li> <!-- Prepare 4ms --> <!-- Method 3ms --> <li class="footer__extra-link-item">Powered by <a href="https://hydro.js.org">Hydro v4.7.2</a> Community</li> </ol> </div> </div> </div></div> </div> </div> <script> var UiContext = '{"cdn_prefix":"/","url_prefix":"/","ws_prefix":"/","nav_logo_dark":"/components/navigation/nav-logo-small_dark.png","constantVersion":"bb03f26b","domainId":"system","domain":{"_id":"system","owner":1,"name":"Hydro","bulletin":"Hydro System","roles":{"root":"-1","guest":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652661870373870220902529","default":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652809806901414229410497","student":"10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652809806901414229410497"},"avatar":"","lower":"system"},"extraTitleContent":"\u3010\u5165\u95E8\u3011\u5927\u5C0F\u5199\u8F6C\u6362","SWConfig":{"hosts":["http://219.153.61.2:20004","https://219.153.61.2:20004","/","/"],"domains":[]}}'; var UserContext = '{"_id":172,"mail":"tyz@126.com","uname":"tyz","hashType":"hydro","priv":66564,"regat":"2022-10-27T07:52:32.640Z","loginat":"2023-02-18T01:57:40.978Z","perm":"BigInt::10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652809806901414229410497","scope":"BigInt::-1","role":"default","tfa":false,"authn":false,"group":["2022\u5189\u961F","2023\u6821\u57F9","172","172"],"viewLang":"zh","skipAnimate":true,"timeZone":"Africa/Abidjan","codeLang":"java","codeTemplate":"#include<iostream>\\r\\nusing namespace std;\\r\\nint main(){\\r\\n return 0;\\r\\n}","avatar":"//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=128","qq":"","gender":"0","bio":"\u8BA9\u4F60\u4EEC\u5C1D\u5C1D\u6218\u6817\u7684\u6ECB\u5473\uFF0C\u56E0\u5BD2\u51B7\uFF0C\u4E5F\u56E0\u754F\u60E7\u3002\\r\\n\\r\\n","school":"\u5C3F\u9891\u5B9E\u9A8C\u5C0F\u5B66","studentId":"2028348975634759437539465936555555555555555555548520523","backgroundImage":"/components/profile/backgrounds/2.jpg","unreadMsg":0,"fontFamily":"Microsoft Yahei","codeFontFamily":"Ubuntu Mono","preferredEditorType":"sv","monacoTheme":"vs-light","theme":"dark","showInvisibleChar":true,"formatCode":true,"displayName":"6","nAccept":64,"nSubmit":102,"rp":187.77742878666663,"rpInfo":{"problem":187.77742878666663},"rank":49,"level":5,"avatarUrl":"//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&s=128"}'; </script> <script type="text/javascript" src="/resource/4.47.2/lang-zh.js"></script> <script type="text/javascript" src="/hydro-4.47.2.js"></script> </body> </html> -
-2
#include<bits/stdc++.h> using namespace std; const int N = 510; int n, m; int d[N]; bool g[N][N]; int stop[N]; int q[N]; void bfs(){ memset(d, 0x3f, sizeof d); //初始化距离 q[0] = 1; d[1] = 0; int hh = 0, tt = 0; while(hh <= tt){ int t = q[hh ++ ]; for(int i = 1; i <= n; i ++ ){ //之前我一直在迷惑为什么1~n的换乘次数会等于1~n的乘车次数-1 //其实道理很简单,即从x~y点的最近距离要么是1,要么是换乘次数最少的距离 //如果x、y在同一条线路,那最短距离肯定是1 //如果不在同一条线路,那最短距离就会被换乘的站点之间更新,因为一直在找最小距离 //所以1~n的换乘次数会等于1~n的乘车次数-1 if(d[i] > d[t] + 1 && g[t][i]){ //如果点i和点t之间有通路且通过t可以找到到达i的更小距离 d[i] = d[t] + 1; q[ ++ tt] = i; } } } } int main() { cin>>m>>n; string line; getline(cin, line); //读取m、n后面的空格/换行符 while(m -- ){ getline(cin, line); //读入一行 stringstream ssin(line); //定义字符串流ssin,用line初始化ssin(相当于赋值) int cnt = 0, p; while(ssin>>p) stop[cnt ++ ] = p; //将同一条线路的每个站点和之后的每个站点连一条线 for(int i = 0; i < cnt; i ++ ){ for(int j = i + 1; j < cnt; j ++ ){ g[stop[i]][stop[j]] = true; } } } bfs(); if(d[n] == 0x3f3f3f3f) cout<<"NO"<<endl; else cout<<max(d[n] - 1, 0)<<endl; return 0; } -
-2
#include<bits/stdc++.h> using namespace std; long long read(){ long long ans=0,f=1; char ch=getchar(); while(!isdigit(ch)){ f*=(ch=='-')?-1:1; ch=getchar(); } while(isdigit(ch)){ ans=(ans<<3)+(ans<<1)+(ch^48); ch=getchar(); } return ans*f; } const int MAXN=505; int e[MAXN][MAXN],n,m,a,b; int main(){ n=read(),m=read(); memset(e,0x3f,sizeof(e)); for(int i=1;i<=m;i++){ int x=read(),y=read(),l=read(); e[x][y]=l;e[y][x]=l; } for(int k=1;k<=n;k++){ for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ e[i][j]=min(e[i][j],e[i][k]+e[k][j]); } } } a=read(),b=read(); if(e[a][b]==0x3f3f3f3f)cout<<"No path"; else printf("%d",e[a][b]); } -
-2
#include<bits/stdc++.h> using namespace std; int read(){ int ans=0,f=1; char ch=getchar(); while(!isdigit(ch)) f *= (ch=='-') ? -1 : 1, ch = getchar(); while(isdigit(ch)) ans = ((ans<<1)+(ans<<3)+(ch^48)),ch = getchar(); return ans*f; } const int MAXX = 1e3; int N, M, sum, cnt; int g[MAXX][MAXX], flag[MAXX]; std:: queue <int> q; void dfs(int x){ if(x==1) printf("%d",x); else printf("-%d",x); sum++; flag[x] = 1; for(int i=1;i<=N;i++){ // if(!g[x][i]) continue; // if(flag[i]) continue; if(g[x][i] && (!flag[i])) dfs(i); } } int main(){ N = read(), M = read(); for(int i=1;i<=M;i++){ // int x = read(), y = read(); int x,y; cin>>x>>y; g[x][y] = 1; } dfs(1); while(sum+1<=N){ dfs(sum); }; printf("\n"); memset(flag,0,sizeof(flag)); q.push(1); flag[1] = 1; while(!q.empty()){ int F = q.front(); for(int i=1; i<=N; i++){ if(g[F][i]==1 && (flag[i]==0)){ q.push(i); flag[i] = 1; } } if(F==1) printf("%d",F); else printf("-%d",F); q.pop(); cnt++; } while(cnt<=N){ while(!q.empty()){ int F = q.front(); for(int i=1; i<=N; i++){ if(g[F][i]==1 && (flag[i]==0)){ q.push(i); flag[i] = 1; } } if(F==1) printf("%d",F); else printf("-%d",F); q.pop(); cnt++; } } // for(int i=1;i<=N;i++){ // for(int j=1;j<=N;j++){ // printf("%d ",g[i][j]); // } // printf("\n"); // } return 0; } -
-2
-
-2
信息
- ID
- 1
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 1080
- 已通过
- 367
- 上传者
