什么东西能让我们的生活圆满?
考虑如下算法:
C++#include<bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int ans = 0;
for(char c : s) {
int add = c - 'a' + 1;
ans += add;
}
cout << ans;
return 0;
}
什么样的东西能让我们获得 100 呢?
是 开心 happy 吗?我们算一算:
8+1+16+16+25=66
看来不是。
是 领导力 leadership 吗?我们算一算:
12+5+1+4+5+18+19+8+9+16=97
看来不是。
是 知识 knowledge 吗?我们算一算:
11+14+15+23+12+5+4+7+5=96
看来不是。
是 金钱 money 吗?我们算一算:
13+15+14+5+25=72
看来也不是。
其实,获得 100 分的秘诀就在我们的代码里!
C++#include<iostream>
我们来算算 iostream 吧!
9+15+19+20+18+5+1+13=100
这样我们就获得 100 分啦!
还是 C++ 有用啊!!!
还有呢
attitude 态度:1+20+20+9+20+21+4+5=100
态度改变一切。
problems 问题:16+18+15+2+12+5+13+19=100
要多做题,不然是 problem,只有 81 分。