Lập trình đọc vào giá trị N (N<107 ) Tính tổng các số chia hết cho 3 nhưng không chia hết cho 5 - File dữ liệu vào: Tong_le.inp o Gồm 1 số N - File dữ liệu ra: Tong_le.out o Gồm 1 số là tổng thu được
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.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
freopen("namnhuan.inp","r",stdin);
freopen("namnhuan.out","w",stdout);
cin>>n;
if ((n%400==0) or (n%4==0 && n%100!=0)) cout<<366;
else cout<<365;
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
const fi='tong.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
n,i,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll> mp;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
freopen("MAP1.INP","r",stdin);
freopen("MAP1.OUT","w",stdout);
ll n; cin >> n;
ll a[n+5];
for(ll i=1;i<=n;i++) cin >> a[i], mp[a[i]]++;
for(pair<ll,ll> it:mp) cout << it.first << " " << it.second << "\n";
}
Chúc bạn học tốt!
tính tổng các số chia hết cho 3 nhưng không chia hết cho 5 trong khoảng từ 1 tới n đúng không bạn