7 条题解
-
1lichengjun LV 10 @ 2023-3-28 18:45:52
#include<iostream> using namespace std; int n; long long sum; int main(){ cin>>n; for(int i=1;i<=n;i++){ if(i/10!=7&&i%10!=7&&i%7!=0)sum+=i*i; } cout<<sum; return 0; }
-
12023-1-3 15:11:40@
#include<bits/stdc++.h> using namespace std; int n; int sum; int findd10_7(int x) { while(x) { if(x%10==7)return 1; x/=10; } return 0; } int finddi_7(int x) { if(x%7==0)return 1; return 0; } int main() { cin>>n; for(int i=1;i<=n;i++) { int x=findd10_7(i); int y=finddi_7(i); if(x+y==false)sum+=pow(i,2); } cout<<sum; return 0; }
-
02024-6-21 19:51:37@
#include <math.h> #include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { int n, sum = 0; cin >> n; for(int i = 1; i <= n; i++) { if(i % 7 != 0) { int t = i; t /= 10; } if(t == 0)sum += i * i; } cout << sum; return 0; }
-
02024-6-21 19:50:46@
#include <math.h> #include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { int n, sum = 0; cin >> n; for(int i = 1; i <= n; i++) { if(i % 7 != 0) { int t = i; t /= 10; } if(t == 0)sum += i * i; } cout << sum; return 0; }
-
02024-6-21 19:50:33@
#include <math.h> #include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { int n, sum = 0; cin >> n; for(int i = 1; i <= n; i++) { if(i % 7 != 0) { int t = i; t /= 10; } if(t == 0)sum += i * i; } cout << sum; return 0; }
-
02023-5-24 18:50:26@
#include<iostream> using namespace std; int n; int sum; int main() { cin>>n; for(int i=1;i<=n;i++){ if(i/10!=7&&i%10!=7&&i%7!=0)sum+=i*i; } cout<<sum; return 0; }
-
-12022-7-21 19:07:36@
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long #define ull unsigned long long const int N = 1e3 + 10; const int INF = 0x3f3f3f3f; int main() { int n; cin >> n; int ans = 0; int sum = 0; int num = 0; for(int i = 1 ; i <= n ; i++) { sum = i / 10; num = i % 10; if(i % 7 == 0 || num == 7 || sum == 7) continue; else ans += i * i; } cout << ans << endl; return 0; }
- 1
信息
- ID
- 970
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 358
- 已通过
- 165
- 上传者