Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501
Hoanganh367
Vũ Hoàng Anh
0 0
37501 0 0
37501 0 0
37501 0 0

include<bits/stdc++.h>

using namespace std;
int main()
{
int n;
set<int> se;
while(cin >>n)
{
se.insert(n);
}
cout <<se.size();
}

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0

là lá lá la la là

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0

include <bits/stdc++.h>

using namespace std;

int main()
{
freopen("TONGLAPPHUONG.INP","r",stdin);
freopen("TONGLAPPHUONG.OUT","w",stdout);
long long n,res=0;
cin>>n;
while(n!=0)
{
res += pow(n%10,3);
n/=10;
}
cout<<res;
}

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501
Serious
Quang Huy
0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0

include <iostream>

include <vector>

include <stack>

include <map>

include<iomanip>

include<cmath>

using namespace std;

class Leksema {
public:
char type;
double value;

Leksema(char t, double v) : type(t), value(v) {}

};

double calculate(double a, double b, char op) {
switch(op) {
case '+': return a + b;
case '-': return a - b;
case '*': return a * b;
case '/': return a / b;
default: return 0;
}
}

double stackAnalyze(const vector<Leksema>& list) {
stack<double> nStack;
stack<char> oStack;

map<char, int> priority;
priority['+'] = 1;
priority['-'] = 1;
priority['*'] = 2;
priority['/'] = 2;
priority['('] = 0;

for(size_t i = 0; i < list.size(); ) {
    switch (list[i].type) {
        case 'n':
            nStack.push(list[i].value);
            i++;
            break;
        case '(':
            oStack.push(list[i].type);
            i++;
            break;
        case ')':
            if(oStack.top() != '(') {
                double b = nStack.top();
                nStack.pop();
                double a = nStack.top();
                nStack.pop();
                nStack.push(calculate(a, b, oStack.top()));
                oStack.pop();
            } else {
                oStack.pop();
                i++;
            }
            break;
        default:
            if(oStack.empty() || priority[oStack.top()] < priority[list[i].type]) {
                oStack.push(list[i].type);
                i++;
            } else if(oStack.top() != '(') {
                double b = nStack.top();
                nStack.pop();
                double a = nStack.top();
                nStack.pop();
                nStack.push(calculate(a, b, oStack.top()));
                oStack.pop();
            }
    }
}

while(!oStack.empty()) {
    double b = nStack.top();
    nStack.pop();
    double a = nStack.top();
    nStack.pop();
    nStack.push(calculate(a, b, oStack.top()));
    oStack.pop();
}

return nStack.top();

}

vector<Leksema> lexAnalyze(const string& s) {
vector<Leksema> list;
size_t i = 0;

while(i < s.length()) {
    char symb = s[i];
    if(symb == '+' || symb == '-' || symb == '*' || symb == '/' || symb == '(' || symb == ')') {
        list.push_back(Leksema(symb, 0));
        i++;
    } else {
        if(s[i] >= '0' && s[i] <= '9') {
            string num;
            do {
                num += s[i];
                i++;
                if(i == s.length()) {
                    break;
                }
            } while(s[i] >= '0' && s[i] <= '9' || s[i] == '.');
            list.push_back(Leksema('n', stod(num)));
        } else {
            i++;
        }
    }
}

return list;

}

bool check(string s){
for(int i=0;i<s.size();i++){
if(s[i]=='.') return 1;
}
return 0;
}
int main() {
string expression;
getline(cin, expression);

vector<Leksema> list = lexAnalyze(expression);
double ans = stackAnalyze(list);
if(floor(ans)==ans&&check(expression)){
    cout<<ans<<".0"<<endl;
}
else if(floor(ans)==ans) {
    cout <<static_cast<int>(ans)<<endl;
}
else cout<<round(ans * 10.0) / 10.0 <<endl;

return 0;

}

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501
phamthibaothu10a2
Phạm Thị Bảo Thư
0 0

Everybody was Kung Fu fighting
Those cats were fast as lightning
In fact, it was a little bit frightening
But they fought with expert timing

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0

kkk

37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0
37501 0 0