Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- using namespace std;
- void segmentowiec()
- {
- int t; //liczba segmentów
- cin>>t;
- for(int i=0;i<t;i++)
- {
- int n;
- cin>>n;
- int tab[n];
- for(int j=0;j<n;j++)
- {
- int x;
- cin>>x;
- tab[j]=x;
- }
- int dni=-1;
- dni+=n;
- for(int j=0;j<n;j++)
- dni+=tab[j];
- cout<<dni<<endl;
- }
- }
- void przedszkolanka()
- {
- int N,a,b,c;
- cin>>N>>a>>b;
- for(int i=0;i<N;i++)
- {
- if(a<b)
- {
- while(c%a!=0 or c%b!=0)
- {
- c+=b;
- }
- }
- else
- {
- while(c%a!=0 or c%b!=0)
- {
- c+=a;
- }
- }
- }
- cout<<c;
- }
- int main()
- {
- // segmentowiec();
- przedszkolanka();
- /*ios_base::sync_with_stdio(0);
- const int SIZE = 1000000010;
- vector <int> liczbyPierwsze;
- for(int i = 2; i <= sqrt(SIZE); i++) {
- if(tab[i]) continue;
- liczbyPierwsze.push_back(i*i);
- for(int j = 2*i; j <= sqrt(SIZE); j += i)
- tab[j] = true;
- }
- int a, b, t;
- cin >> t;
- while(t--) {
- cin >> a >> b;
- int zlicz = 0;
- for(int i = 0; i < liczbyPierwsze.size(); i++) {
- if(liczbyPierwsze[i] >= a && liczbyPierwsze[i] <= b)
- zlicz++;
- if(liczbyPierwsze[i] > b)
- break;
- }
- cout << zlicz << endl;*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment