Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ifstream fin("MATKHAU.INP");
ofstream fout("MATKHAU.OUT");
vector<string> matkhau;
string line;
while (getline(fin, line)) {
if (line.empty()) continue;
stringstream ss(line);
vector<long long> a;
long long x;
while (ss >> x) {
a.push_back(x);
}
int m = a.size();
long long cnt = 0;
// Đếm số bộ 3 thỏa mãn
for (int i = 0; i < m; i++) {
for (int j = i + 1; j < m; j++) {
for (int k = j + 1; k < m; k++) {
long long sum = a[i] + a[j] + a[k];
long long prod = a[i] * a[j] * a[k];
if (sum != 0 && prod % sum == 0)
cnt++;
}
}
}
matkhau.push_back(to_string(cnt));
}
// Ghi mật khẩu (viết liền)
for (string &s : matkhau)
fout << s;
fin.close();
fout.close();
return 0;
}
Bài 1.
Bước 1. Nhập N và dãy số \(a_1,a_2,...,a_N\)
Bước 2. \(i\leftarrow1\), \(S\leftarrow0\)
Bước 3. \(i\leftarrow i+1\)
Bước 4. 4.1 Nếu \(i>N\) thì kết thúc thuật toán và đưa ra kết quả.
4.2 \(a_i\ge0\) thì quay lại bước 3
4.3 \(S\leftarrow S+a_i\) rồi quay lại bước 3
code nè:
def tong_uoc_duong(n):
n=abs(n)
if n==0:
return 0
tong=0
for i in range(1,n+1):
if n%i==0:
tong+=i
return tong
t=int(input())
lst=[int(input()) for _ in range(t)]
kq=[str(tong_uoc_duong(x)) for x in lst]
print(" ".join(kq))
2:
#include <bits/stdc++.h>
using namespace std;
int i,dem,s;
int main()
{
dem=0;
s=0;
for (i=1; i<=100; i++)
if (i%2==0)
{
dem++;
s=s+i;
}
cout<<fixed<<setprecision(2)<<(s*1.0)/(dem*1.0);
return 0;
}
# Nhập số nguyên dương N từ bàn phím
N = int(input("Nhập số nguyên dương N: "))
# Khởi tạo dãy số nguyên
numbers = []
# Vòng lặp để nhập N số nguyên và thêm chúng vào danh sách numbers
for i in range(N):
number = int(input("Nhập số thứ {}:".format(i+1)))
numbers.append(number)
# In ra dãy số đã nhập
print("Dãy số bạn đã nhập là: ", end="")
for number in numbers:
print(number, end=" ")
print()
# Tính tổng các số chia hết cho 3 và in ra màn hình
total = 0
for number in numbers:
if number % 3 == 0:
total += number
print("Tổng các số trong dãy chia hết cho 3 là: ", total)
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,k;
int main()
{
cin>>n>>k;
for (i=1; i<=n; i++)
{
cout<<x;
if (x==k) cout<<i<<" ";
}
return 0;
}

em lớp mấy mà hỏi c dễ thế
We are going out for a little longer than expected to get the car out and we can go over the next