1
DevGod
Elf Vtuber
#include <iostream>#include <unordered_set>#include <numeric>
using namespace std;int main(){ unordered_set<int> mySet; for(int I = 1; I<1000; I++){ if(I%3 == 0 || I%5 == 0){ mySet.insert(I); } } int score = accumulate( mySet.begin(), mySet.end(), 0); cout << score << endl; return 0;}import java.util.*;import java.util.HashSet;
public class E1 { public static void main(String[] args) { HashSet<Integer> mySet = new HashSet<Integer>(); for(int I = 1; I<1000; I++){ if( (I%3) == 0 || (I%5) == 0){ mySet.add(I); } } int score = mySet.stream().mapToInt(Integer::intValue).sum(); System.out.println( score ); }}let mySet = new Set();
for(let I = 1; I<1000; I++){ if(I%3 == 0 || I%5 == 0){ mySet.add(I); }}
let score = [...mySet].reduce( (sum,el)=>sum+el, 0);
console.log(score);mySet = set()
for I in range(1, 1000): if I%3 == 0 or I%5 == 0: mySet.add(I)
print( sum(mySet) )